logo       

GADT: weird error message: msg#00019

lang.haskell.glasgow.bugs

Subject: GADT: weird error message

In the code below the function "trans" is accepted by GHC 6.4, but "trans1" is not. I would expect that "(x,y)" is just syntactic sugar for "(,) x y", but apparently it isn't. I guess this is a bug; can anyone explain what is going on?

Cheers,

Arthur

The Code:
data Equal a b where
Eq :: Equal a a

trans :: forall a b c. Equal a b -> Equal b c -> Equal a c
trans = \x -> \y -> case (,) x y of
(Eq,Eq ) -> Eq

trans1 :: forall a b c. Equal a b -> Equal b c -> Equal a c
trans1 = \x -> \y -> case (x, y) of
(Eq,Eq ) -> Eq

The error message:
Test2.hs:9:0:
Quantified type variable `c' is unified with another quantified type variable a
When trying to generalise the type inferred for `trans1'
Signature type: forall a b c. Equal a b -> Equal b c -> Equal a c
Type to generalise: Equal a b -> Equal b a -> Equal a a
In the type signature for `trans1'
When generalising the type(s) for `trans1'


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise