Template Haskell Workshop
This is the repository for a Template Haskell tutorial. See the proposal for the original inspiration.
Markdown Unlit is a GHC plugin for rendering Markdown as Literate Haskell. Exercises in this tutorial are written in Markdown, so we need to install the package.
stack install markdown-unlit
We will always test a module by loading it into GHCi:
stack ghci th-tutorial
Also recommend keeping a tab open to the docs for Template Haskell: https://www.stackage.org/lts-14.22/package/template-haskell-2.14.0.0
The first two exercises are exploratory in GHCi to get a feel of how Template Haskell works. The next exercises go into more detail about how to define and test generated code.
Start in the src
folder and fill in the TODO
parts of each exercise. The solved
directory contains hints and
spoilers.