FW: [Template-haskell] TH restrictions

Ian Lynagh igloo at earth.li
Wed Nov 17 20:15:25 EST 2004


On Fri, Aug 20, 2004 at 04:37:16PM +0100, Simon Peyton-Jones wrote:
> 
> Does anyone care? I'm busy implementing GADTs at the moment, so TH has a
> somewhat back seat.  It'll probably stay that way unless there are some
> signs of life in the TH ranks.

For what it's worth, I think one of the biggest irritations I've had
with writing stuff using TH is the need to split things across module
boundaries. This often leads to things that should logically be in the
same module being split (and I think I even have had a case or two when
I had to split something off out of the split-off module!), making the
code harder to read. I think TH needs to have as small a syntactic
impact as possible to take off.

I understand that there can be a compile-time performance penalty if
this restriction is lifted, due to the need to compile to bytecode for
TH and then object code for the .o file, but I think this would easily
be made up for in the increased clarity of code, especially if only
those bits that were needed were compiled to bytecode.

Also, I think this has got worse at some point. Going back over some of
my old code it looks like this sort of thing:

    foo = and
    bar = [| foo |]

in one module used to be OK whereas now it gives

    No instance for (Language.Haskell.TH.Syntax.Lift ([Bool] -> Bool))


Thanks
Ian



More information about the template-haskell mailing list