[Haskell-cafe] Template Haskell question?

Per Larsson per at L4i.se
Wed Feb 11 10:39:24 EST 2004

I have written a small TH application (module THRecord) which creates update 
functions for records. It is intended to be used like this:

    import THRecord

    data Record = R {... 
    $(THRecord.generateRecordModifiers (reifyDecl Record))

It works great, but only if the splice is placed last in the importing module! 
If I place it in the middle of the module it seems to hide subsequent 
declarations and I get 'Variable not in scope ...' compiler errors. If I 
place it at the top of the module I get:

    ghc-6.2: panic! (the `impossible' happened, GHC version 6.2):
            nameModule Record {- tc 01D -}

Has anybody a clue of what is happening here?

-- Per

More information about the Haskell-Cafe mailing list