RE: Why doesn't this program work?
Thanks for the bug report. Yes the template-haskell mailing list should work. I'm ccing it. | I compiled the following program with ghc-5.05.20030109 | | ---------- | | import Language.Haskell.THSyntax | | main = putStrLn (show $(lift ('a', 'b'))) | | instance (Lift a, Lift b) => Lift (a,b) where | lift (a,b) = tup [lift a, lift b] | | ----- | | and received the following error message | | ghc-5.05.20030109: panic! (the `impossible' happened, GHC version | 5.05.20030109): | nameModule zdfLiftZ2T{-a1dB-} Well, the error message is appalling, and I'll improve it forthwith, but the reason is simple: GHC doesn't allow you to call a locally-defined function inside a top-level splice. (It makes sense, but requires GHC to compile code inconveniently early, for the module being compiled.) So you have to put the instance decl in a separate module and compile that first. The error message will say so, shortly. Simon
participants (1)
-
Simon Peyton-Jones