Allow splicing Stmt
Summary
The Stmt
type is used by template-haskell
to represent do syntax statements.
They currently cannot be spliced, but it would be good to make this possible.
Motivating example
Take this example from esqueleto:
DoE
#if MIN_VERSION_template_haskell(2,17,0)
Nothing
#endif
(statements ++ [NoBindS $ AppE (VarE 'pure) (RecConE constructorName fieldExps)])
Here CPP has to be used because, at some point in the past, the TH syntax was extended to account for qualified do.
We would instead like to write the much nicer (no CPP and the surrounding code can also be a quote):
[|
do
$(statements ++ [..])
|]
Proposal
When in a do statement, we should try to splice Stmt
rather than Exp
Alternatively Stmt
should be folded into Exp
.