I am proposing an additional feature,
-ddump-splices-file that generates a corresponding
.hs.th file for every
.hs file that uses Template Haskell.
-ddump-splices is an invaluable but a frustrating way to look at generated Haskell code. If TH generation were some kind of error message, the current output would make sense. However, TH is generating code that we rely on and would be easier to comprehend if we could see it in a way the most similar to our existing Haskell code.
There is a valid complaint that when TH defines something you can't just grep for it, you have to know what TH is defining by reading documentation and imagining something that isn't in front of you.
If you have a file
-ddump-splices-file will generate
Foo.hs.th. Then whenever someone greps after buliding they will find the declaration. If you check these files in they can grep even before building. Similarly, an IDE can show these files as the source of a declaration. Also, if the TH generation changes in some way when a TH function changes, that will be visible.
This seems like a relatively easy feature to add. Any pointers on where to get started?