haskell-src-exts-qq-0.4.0: A quasiquoter for haskell-src-exts.



This module defines quasiquoters for haskell-src-exts expressions and declarations.

Antiquotations steal the splice syntax of Template Haskell, so for example example x appears antiquoted in [$hs| $x ++ $(Hs.strE "bar") |]. Expressions appearing inside parenthesized splices are limited to concrete syntax expressible by Template Haskell's Exp data type.

Names in patterns can also be antiquoted, using double parentheses. For instance:

 let f = Hs.name "foo" in [$dec| ((f)) x = x + x |]

In a pattern context, antiquotations use the same syntax.



hs :: QuasiQuoterSource

A quasiquoter for expressions. All Haskell extensions known by haskell-src-exts are activated by default.

dec :: QuasiQuoterSource

A quasiquoter for top-level declarations.

hsWithMode :: ParseMode -> QuasiQuoterSource

Rather than importing the above quasiquoters, one can create custom quasiquoters with a customized ParseMode using this function.

 hs = hsWithMode mode
 dec = decWithMode mode