Bug in GHC 5.02.1
Simon Peyton-Jones
simonpj at microsoft.com
Fri Dec 21 10:42:48 EST 2001
Thank you. I fixed this in the HEAD, but your message
reminded us to transfer that fix to the 5.02 branch for the
upcoming 5.02 release.
Workaround: write a selector for the newtype manually
instead of using the record syntax.
Simon
| -----Original Message-----
| From: Arthur Baars [mailto:arthurb at cs.uu.nl]
| Sent: 21 December 2001 12:41
| To: glasgow-haskell-bugs at haskell.org
| Subject: Bug in GHC 5.02.1
|
|
| 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
|
|
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-| haskell-bugs
|
More information about the Glasgow-haskell-bugs
mailing list