I am an experience researcher in functional programming. I have been deeply involved in the design and implementation of embedded DSLs for property-based testing, state-based testing, task-oriented programming and tierless IoT programming. All of these topics are described in scientific publications. I wrote several publications on implementation techniques of eDSLs. My master course about advanced programming is largely focused about the design and implementation of embedded DSLs.
This talk is intended for functional programmers and architects with some experience. It will improve the understanding of DSL and library design. Although the talk uses a Haskell like language in the examples, the topic is not restricted to this audience.
A Domain Specific Language, DSL, is a computer language specialized for some specific domain. Examples are text processing, creation of webpages, specifying properties for software testing and task-oriented programming. Some DSLs are standalone, like LaTeX for text processing. An embedded DSL, eDSL, can be combined with other parts of the language. DSLs have been created in functional programming languages like Haskell, Clojure, Scala and Erlang. Creating libraries as an eDSL allows us to focus more on the design of the language extension and offers guidance for its implementation.
DSL implementation techniques
1) The DSL is a datatype. This is the motivation behind GADTs. We need Higher Order Abstract Syntax to create type safe identifiers. This allows different views, like printing and execution.
2) The DSL is a set of functions. This uses the full host language, but is limited to a single view.
3) A set of type classes combines the flexibility of functions with multiple views.