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 a.
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 theQmonad 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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.6.3 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |