Name should be spliceable
On discourse tomsmeding writes:
pure $ ConP 'Value [] [VarP var]
==>
[| Value $(varE var) |]
pure $ mkTySynInstD ''ToMaybeT (ConT sqlName) (ConT sqlMaybeName)
==>
[d| type $(varT ''ToMaybeT) = $(varT sqlName) $(varT sqqlMaybeName) |]
-- actually not so sure about this one, but it *must* work some way; otherwise bug report
My main gripe with TH quotes is that your second example does not work. Splices fit in places in the syntax where you can fit either a type, an expression or a list of declarations [EDIT: or a pattern]. A name is none of those, nor is the left-hand side of a declaration (like here), or an instance head (the XX in instance ... => XX where). Names occur in many places: if you want to generate a bunch of foreign declarations 1, or a bunch of function declarations 1, you’re out of luck even if you’re doing absolutely nothing interesting with the syntax, and the generated Haskell code should work to back in the GHC 7 era.
Perhaps we should support splicing Name
s. We have 'foo
which is quoting for Name
s so it would make sense to also allow splicing to be consistent with other forms.