Open sgraf812 opened 3 years ago
I wonder, @RyanGlScott could clarify, how well the "pretty printing TH expressions / declarations roundtrips".
I recall he spend some time fixing issues, and I'm pretty sure that is subtle.
I mean, that is great, but probably template-haskell
"maintainers" (which AFAIK is Ryan alone?) should be aware of this "real production" use scenario.
The problem is that Happy does not parse/rename the source code, so it cannot embed it in the TH AST.
I want to give the TH AST extension constructors (Void by default) so arbitrary stuff can be interleaved with the TH AST then printed back.
That would mean happy can use TH and yet also work as is.
Although the current practice of simply concatenating Strings and dumping the result in a .hs file is simple, I think the general plan should be to do all the staging as part of (Typed?) Template Haskell meta programming. A very reasonable step in-between is to generate a TH AST in the backend which is subsequently pretty-printed to generate the .hs file.