Re: panic: addImpDecls

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.template
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.