Tutorial: (English)

Staging with Typed Template Haskell

Typed Template Haskell is a little known subset of Template Haskell that allows the creation of strongly typed metaprograms. By employing such metaprograms, the user gets explicit control over what parts of the program get evaluated at compile time, and what parts get evaluated a run time, without having to rely on predicting the heuristics of the optimiser. This, for example, allows the creation of staged domain-specific languages which are guaranteed to produce reasonably efficient code. In the tutorial, we are introducing the language constructs of Typed Template Haskell and will look at several examples of how it can be used in practice.

Basic familiarity with Haskell is helpful for following this tutorial. No previous knowledge of Template Haskell or Typed Template Haskell is needed, nor is experience with metaprogramming or familiarity with any Haskell type system extensions.

Andres Löh


Andres Löh is a Haskell consultant and co-owner of Well-Typed LLP. He is based in Regensburg, Germany. He started using Haskell in 1997, when being an undergraduate student of mathematics in Konstanz, and has been an enthusiastic functional programmer ever since. Andres obtained a PhD in Computer Science from Utrecht University in 2004, on extending the Haskell language with capabilities for datatype-generic programming. After having been a university lecturer for several years, he joined Well-Typed in 2010.

Andres is very interested in applying functional programming to real-world problems, and in particular in datatype-generic programming, domain-specific languages, (dependent) type systems, parallel and concurrent programming, and the theory of version control.