[Haskell-cafe] Possible bug in GHC 7.0.3

Yitzchak Gale gale at sefer.org
Wed Jun 29 11:37:39 CEST 2011


Daniel Fischer wrote:
> No, the instance head is just a type variable, not a type constructor
> applied to type variables

Oops, you're right. GHC was telling the truth, I should have
paid closer attention!

Fixing my minimal example, I get:

{-# LANGUAGE MultiParamTypeClasses, UndecidableInstances #-}
module ClassContextBug where
class A a oops
class B b
data D d = D d
instance A a oops => B (D a)

and now GHC compiles it happily.

So it's the derived Read instance in this context that
is causing the problem. Here is a slightly smaller test
case that triggers the bug:

{-# LANGUAGE MultiParamTypeClasses, UndecidableInstances #-}
module Bug where
class A a oops
data D d = D d
instance A a oops => Read (D a)
data E e = E (D e) deriving Read

Thanks,
Yitz



More information about the Haskell-Cafe mailing list