Bug in GHC 5.02.1
Arthur Baars
arthurb at cs.uu.nl
Fri Dec 21 07:40:43 EST 2001
I got the following message from GHC version 5.02.1 when compiling one of my
programs.
I compiled using the -fglasgow-exts flag on a Windows 2000 machine;
on Solaris (with GHC 5.02) the same error occurs.
ghc: panic! (the `impossible' happened, GHC version 5.02.1):
applyTypeToArgs eqa{-r5S-} eqf{-srd-} f1{-sre-}
Please report it as a compiler bug to glasgow-haskell-bugs at haskell.org,
or http://sourceforge.net/projects/ghc/.
The module Test is a stripped version of my program that still produces this
error:
module Test where
class Apply f where
(.$.) :: f (a->b) -> f a -> f b
lift :: a -> f a
data MyDynamic f = forall x . f x ::: Type x
newtype Equal a b = Equal{ getEqual :: forall f . f a -> f b }
data Type a = forall x y . Func (Equal a (x -> y))
(Type x)
(Type y)
| Int (Equal a Int)
match :: Type a -> Type b -> Maybe (Equal a b)
match _ _ = Nothing
rewriteArg :: Equal b d
-> Equal a (b->c)
-> Equal a (d->c)
rewriteArg a b = let Proj_Arg r = getEqual a (Proj_Arg b)
in r
newtype Proj_Arg a y x = Proj_Arg (Equal a (x->y))
apply :: Apply f
=> MyDynamic f
-> MyDynamic f
-> Maybe (MyDynamic f)
apply (f ::: ft) (a ::: at) =
do Func eqf tx ty <- return ft
eqa <- tx `match` at
let f' = getEqual (rewriteArg eqa eqf) f
return (f' .$. a ::: ty)
I have no clue what the error is about.
I suspect that the type variable f in the type of apply and the application
of the rewriteArg function somehow cause things to go wrong in GHC.
*) If I instantiate the apply function for the identity type constructor
then the error does not occur anymore:
apply :: MyDynamic Id
-> MyDynamic Id
-> Maybe (MyDynamic Id)
newtype Id x = Id x
instance Apply Id
*) If I set the right-hand side of the definition of f' to undefined then
the error does not occur either.
Cheers Arthur
More information about the Glasgow-haskell-bugs
mailing list