[Template-haskell] TH bug reported (GHC 6.4)

kyra kyrab at mail.ru
Fri Apr 22 21:19:41 EDT 2005


I have the following Haskell modules:

<genCG.hs>
{-# OPTIONS -fglasgow-exts #-}
module GenCG where

gdecls pbname pbniname = [d|
 valGetter pbname = "Get" ++ $pbniname
 valSetter pbname = "Set" ++ $pbniname
 fldGetter pbname = "Get" ++ $pbniname ++ "Field"
 fldSetter pbname = "Set" ++ $pbniname ++ "Field"
 arrGetter pbname = "Get" ++ $pbniname ++ "ArrayItem"
 arrSetter pbname = "Set" ++ $pbniname ++ "ArrayItem"
 gvarGetter pbname = "Get" ++ $pbniname ++ "GlobalVar"
 gvarSetter pbname = "Set" ++ $pbniname ++ "GlobalVar"
 svarGetter pbname = "Get" ++ $pbniname ++ "SharedVar"
 svarSetter pbname = "Set" ++ $pbniname ++ "SharedVar"
 |]
</genCG.hs>

and

<spliceCG.hs>
{-# OPTIONS -fglasgow-exts #-}
module SpliceCG where

import GenCG

$(gdecls "integer" [| "Int" |])
$(gdecls "unsignedinteger" [| "Uint" |])
</spliceCG.hs>

Trying to compile 'spliceCG.hs' I'm recieving the following:

Loading package base-1.0 ... linking ... done.
Loading package haskell98-1.0 ... linking ... done.
Loading package template-haskell-1.0 ... linking ... done.
ghc.EXE: panic! (the `impossible' happened, GHC version 6.4):
        plusProv SpliceCG SpliceCG

Please report it as a compiler bug to glasgow-haskell-bugs at haskell.org,
or http://sourceforge.net/projects/ghc/.

If I splice in a single declaration, for example:
<spliceCG.hs>
{-# OPTIONS -fglasgow-exts #-}
module SpliceCG where

import GenCG

$(gdecls "integer" [| "Int" |])
</spliceCG.hs>

it is compiled just fine.


More information about the template-haskell mailing list