Rename Q (TExp a) to Code a
I propose that we modify the typed template haskell API so that quoting an expression of type
t results in a value of type
Code t rather than
Q (TExp a) and the splice construct requires an argument of type
Code a to produce a value of type
The definition of
Code is as follows.
newtype Code a = Code (Q (TExp a))
There are two good reasons to do this.
Q (TExp a)is ugly and leaks implementation details to the user. Using effects from the
Qmonad is unsafe and against the principle of staged programming.
- Writing instances for
Q (TExp a)is quite difficult. It's much easier when the newtype is defined but at the cost of constant wrapping and unwrapping.