RE: [Template-haskell] panic: addImpDecls
Strange. GHC just doesn't allow nested declaration splices -- and gives a horrible message to boot. I'm not sure why I hadn't even registered that point. Turns out that the way to fix this is closely connected with preparatory work towards producing *typed* TH syntax trees. TH has grown quite a long to-do list in the last month. I'll try to do something about it before our Xmas release of 6.4. How urgent is this particular thing for you? Simon | -----Original Message----- | From: template-haskell-bounces@haskell.org [mailto:template-haskell-bounces@haskell.org] On | Behalf Of Ian Lynagh | Sent: 21 November 2004 23:59 | To: template-haskell@haskell.org | Subject: [Template-haskell] panic: addImpDecls | | | Hi all, | | If I have | | module Q () where | | $( [d| | $( [d| foo = 'c' |] ) | |] | ) | | or even | | module Q () where | | $( [d| | $( [] ) | |] | ) | | then "ghc -fth --make Q.hs" gives me: | | ghc-6.3: panic! (the `impossible' happened, GHC version 6.3): | addImpDecls | | | Thanks | Ian | | _______________________________________________ | template-haskell mailing list | template-haskell@haskell.org | http://www.haskell.org/mailman/listinfo/template-haskell
On Mon, Nov 22, 2004 at 02:56:28PM -0000, Simon Peyton-Jones wrote:
Strange. GHC just doesn't allow nested declaration splices -- and gives a horrible message to boot. I'm not sure why I hadn't even registered that point.
Turns out that the way to fix this is closely connected with preparatory work towards producing *typed* TH syntax trees.
TH has grown quite a long to-do list in the last month. I'll try to do something about it before our Xmas release of 6.4. How urgent is this particular thing for you?
Not very. Roughly speaking, I was writing a small script to turn a certain module that looks like stuff1 $( stuff2 ) $( stuff3 ) into stuff1 stuff2' stuff3' for non-TH-friendly platforms, partly by creating a module $( xs <- [d| $( stuff2 ) $( stuff3 ) |] runIO $ writeFile "foo.tail" $ pprint xs return [] ) , but I've just hand optimised out the inner bit and the library is unlikely to change in the near future. Is it possible to make GHC print out "source after TH is run" (that can be fed back into GHC), BTW? Hmm, I suppose this would also need to add imports for generated stuff, and preferably not import them from GHC.*. (It wouldn't actually help here as the source is actually a .hsc file, but in general I think it would be useful. Hmm, actually, I could probably factor the .hsc bits out into a separate module anyway.) Thanks Ian
participants (2)
-
Ian Lynagh -
Simon Peyton-Jones