It's possible to pass GHC flags on the command line when using
cabal. One flag that I always end up using when
working with Template Haskell is
following shows how to pass it to cabal.
$ cabal run --ghc-options="-ddump-splices"
There are a couple things to watch out for.
- When recompiling,
cabalwill only recompile source files that have changed. If you are expecting the Template Haskell to be dumped to the console and it's not, you may want to change the file in question by adding extra space or an extra newline. This will cause
cabalto see that the file has changed, recompile it, and dump the Template Haskell to the console.
--ghc-options(the cabal flag) begins with two hyphens, while
-ddump-splices(the ghc flag) begins with only one hyphen.