#902: Deriving for H98 types using GADT syntax fails
----------------------------------------+-----------------------------------
Reporter: [EMAIL PROTECTED] | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.5
Severity: normal | Keywords:
Os: Unknown | Difficulty: Unknown
Architecture: Unknown |
----------------------------------------+-----------------------------------
This example from the GADT section of the user manual:
{{{
data Maybe1 a where {
Nothing1 :: Maybe1 a ;
Just1 :: a -> Maybe1 a
} deriving (Eq,Ord)
}}}
Fails with:
{{{
Test_show.hs:28:5:
Can't derive instances where the instance context mentions
type variables that are not data type parameters
Offending constraint: Eq a
When deriving the instance for `Eq (Maybe1 a)'
Test_show.hs:28:5:
Variable occurs more often in a constraint than in the instance head
in the constraint: Eq a
(Use -fallow-undecidable-instances to permit this)
In the derived instance declaration
instance (Eq a) => Eq (Maybe1 a)
}}}
-dppr-debug gives this:
{{{
Test_show.hs:28:5:
Can't derive instances where the instance context mentions
type variables that are not data type parameters
Offending constraint: base:GHC.Base.Eq{tc 23} a{tv adf} [tv]
When deriving the instance for `base:GHC.Base.Eq{tc 23}
(main:Test_show.Maybe1{tc ray} a{tv adg} [tv])'
Test_show.hs:28:5:
Variable occurs more often in a constraint than in the instance head
in the constraint: base:GHC.Base.Eq{tc 23} a{tv adf} [tv]
(Use -fallow-undecidable-instances to permit this)
In the derived instance declaration
instance (base:GHC.Base.Eq{tc 23} a{tv adf} [tv]) =>
base:GHC.Base.Eq{tc 23} (main:Test_show.Maybe1{tc ray} a{tv
adg} [tv])
}}}
The two "a":s appear to be different, "a{tv adf}" and "a{tv adg}".
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/902>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs