David Laing

Share

Haskell enthusiast
 dlaing.org

Dave had programmed in a handful of mainstream languages for years and years. He came across Haskell along the way and made the decision to dive in. This has been followed by a lot of code, a handful of talks, and haranguing people to read various textbooks.

YOW! Lambda Jam 2016 Brisbane

Little Languages

TALK –  VIEW SLIDES WATCH VIDEO

Languages in the ML family are great for writing domain-specific languages (DSL)s. We can use ideas from programming language theory (PLT) to make our DSLs more powerful, and we can use tools from the Haskell ecosystem to make our implementation easier to write, test, maintain and change.

This will be a lightning tour of how to build up a DSL that will get progressively more advanced throughout the talk. We’ll be exploring ways to keep the results testable (via QuickCheck) and composable along the way.

The first thing we’ll look at is operational semantics. We’ll specify the semantics of our DSL, implement the semantic rules in Haskell, and use that to derive an evaluator for our DSL. This in turns leads to a discussion of type systems. Some DSL programs can get stuck during evaluation, and type system can be used to check that a DSL program won’t get stuck.

Having both the semantic and type system specified also provides some opportunities for testing, and we can bias our implementation in order to do this in a way that will boost our confidence in the resulting DSL.

The next piece of the puzzle we will look at s parsing and pretty printing the DSL. Most importantly, we’ll cover the use of trifecta for parsing. This provides support for very good error messages, both in the parsing stage and in the type checking stage.

The last thing we’ll look at is lambda calculus, and how to embed lambda calculus into our DSL. This is a big step forward since it allows users of the DSL to abstract and reuse fragments of DSL programs. The implementation will be greatly assisted by the use of the bound library.

The remainder of the talk will be discussing various extensions and improvements that are either very useful or quite exciting.

The material will eventually appear in much more detail on http://dlaing.org. Most of the PLT material is covered in Pierce’s “Types and Programming Languages” and Harper’s “Practical Foundations of Programming Languages”.