Note that:
Exp
intemplate-haskell
corresponds toHsExpr
in the GHC ASTType
intemplate-haskell
corresponds toHsType
in the GHC ASTDec
intemplate-haskell
corresponds toHsDecl
in the GHC AST
However, there is one set of constructors missing in the template-haskell
types: those pertaining to TH splices and quasiquotes. For example, why doesn't Exp
have a constructor of the following form?
SpliceE :: Exp -> Exp
I've stumbled across this here too. I'd like to know if there is something fundamental about this, or there is just extra work to be done fleshing out the TH types? I suspect the issue is that with this, one could send TH into an infinite loop - have a splice generating another splice, and so on. That said, there are already many ways of making the GHC diverge... :)
My use case is wanting to have an extra TH stage (so that I can lift a value to the type level - in the parent stage it is a value, but I can generate code with that value lifted to the type level for the child stage using promote
)