Thanks you all for the links.
I’m not pushing for untyped string vs Q, just to have a lighter macro system.
By lighter I mean
- a) no sectioning of the file (order shouldn’t matter) when possible
- b) being able to use functions definition in the same file
- c) not having to learn a new “language”: use quotation as much as possible
- d) avoid unnecessary recompilation
- e) resiliant to GHC internal changes
I realized that TH is more capable than I though it was (thanks to @rhendric) and there already some discussions going own about how to improve the situation (even though it seems a bit all over the place).
To summarize
The use of let clauses addresses b) in some cases (maybe it could be added explicitely in the wki) but doesn’t allow “in place” definition of quasiquoter (correct me if Y am wrong).
Provide basic QuasiQuoters in template-haskell might helps.
#529 Untyped Template Haskell quotes as patterns seems promising and could help with c) and e).
Introducing a difference between pure and impure splices (as @michealpj suggested ) could help with d) (if there is really a problem there): A pure splices should only depends on the input files and as such needs only need to follow “normal” file recompilation rules.
This leave a) (which I believe is called “stage restriction” unless it is the name for b) or both). I am still not sure if this problem
is only the result of implementations detail or if there is something deeper to it and if there is a difference between splies $(..)
and quasi quoting ([|...|]
)
But my intuition is that things like using quasi quoting to do string interpolation or precalculating constants should be able to work without affecting the order in which things are defined.
Finally, there seems to be two discussions regarding stability ( point e)) one on gitub and one on gitlab
Which one is the most relevant ? Do we need something to coordinate (tidy?) all those effort ?