Inspecting generated Template Haskell


I wrote a short tutorial on using the GHC flag -ddump-splices to look at the Haskell code generated from quasiquotes and Template Haskell. It is using the heterocephalus library as an example.

You can find the tutorial here.

You should read the tutorial for more information, but the main takeaway is that GHC/stack can be run like the following to produce the splice files:

$ stack build --ghc-options="-ddump-splices"

This produces .dump-splices files somewhere under .stack-work/.

find can be used to figure out the specific path of the files:

$ find .stack-work/ -name '*.dump-splices'

tags: haskell