I recently learned cabal
has a way to specify build-depends
, ghc-options
and more as comments in a source file, which then works with cabal run
and cabal repl
. This combined with markdown-unlit
provides a great way to write blog posts using Markdown formatting (in my case for a Jekyll-based blog) as Literate Haskell modules, which can be executed/tested or loaded in a ghci
REPL.
I wrote a little article showing how this works at Using Literate Haskell with Jekyll » nicolast.be. I imagine the same approach can be used with other static site generators as well, of course