[Haskell-cafe] code generation

Mitchell, Neil neil.mitchell.2 at credit-suisse.com
Tue Nov 4 08:33:36 EST 2008

> > I think using Template Haskell for your work would fit very 
> nicely, so 
> > is a good choice to learn :-)
> > 
> I already got used to TH a bit, but I am not sure if it is 
> appropriate for my purpose, or at least not completely.
> I want to load Haskell code into my program at runtime in an 
> abstract representation (as TH), modify it and then 
> type-check it or coerce it into a value (or execute it). For 
> me it looks like I need a combination of Hint and TH.

Perhaps. You might be able to use the GHC API to get some of what you
want too.

> However, Hint can only interpret strings and to get a string 
> from a QExp I have to enter the IO Monad using runQ. So, 
> wouldn't it deteriorate my performance to do it all in the 
> IO? Is there another way?

I wouldn't worry about performance just yet. In general, Haskell code in
the IO Monad is just as efficient as normal code - the IO Monad gets
almost entirely optimised away by GHC.



Please access the attached hyperlink for an important electronic communications disclaimer: 


More information about the Haskell-Cafe mailing list