This module defines quasiquoters for haskell-src-exts expressions and declarations.
Antiquotations steal the splice syntax of Template Haskell, so for
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 x = Hs.name "n" in [hs| \ ((x)) -> $(Hs.Var (Hs.UnQual x)) + 1 |]
Alternatively, one can use the double underscore syntax, useful when antiquoting a function name as in the following:
let f = "incr" fE = Hs.Var $ Hs.UnQual $ Hs.name f in [hs| let __f__ x = x + 1 in $fE 10 |]
In a pattern context, antiquotations use the same syntax.
A quasiquoter for expressions. All Haskell extensions known by haskell-src-exts are activated by default.
A quasiquoter for types. All Haskell extensions known by haskell-src-exts are activated by default.
Rather than importing the above quasiquoters, one can create custom
quasiquoters with a customized
ParseMode using this function.
hs = hsWithMode mode dec = decWithMode mode