[Template-haskell] RE: Template Haskell...

Alastair Reid alastair at reid-consulting-uk.ltd.uk
Wed Oct 29 21:46:47 EST 2003


More things for the TH wish-list:

I've been using TH to create language extensions.
Unfortunately, the error messages are horrible because:

1) They contain a header generated by TH.
   This contains useful information like line numbers but it 
   talks about TH instead of talking about my extension.

   I want to be able to format the error message header myself using
   information like filename and line number that TH provides to me.

2) They contain a body generated by TH.
   If the code my language extension generates is wrong, 
   there's virtually no chance that any user (myself included)
   will figure it out from seeing the machine-generated Haskell
   code or being given the type error message.
   Better just to say there is a problem and leave it at that.

   I want to be able to construct the error message body myself
   using information like the expression being spliced before
   evaluation, after evaluation and the error message produced.


A related issue is that I generate files corresponding to each TH module I 
compile.  If ghc is producing a file called foo/bar.o, I'd like the name of 
the file to be foo/bar_stub.o.  For this sort of application, I need access 
to the name of the input and output filenames.

Finally, can you drop the 'tick' from variable names produced using gensym?  
If you'd used underscore, the variable name would be a legal C identifier 
too.  (Ok, so this is a bit specialized but it's very easy to do.)

--
Alastair Reid     www.haskell-consulting.com



More information about the template-haskell mailing list