logo       

RE: GADT: weird error message: msg#00061

lang.haskell.glasgow.bugs

Subject: RE: GADT: weird error message

Yes, GHC has a special rule to handle case-of-expression. (We call it
"smart-app" in the paper.) But GHC's front end retains all syntax,
including tuple syntax, and I failed to do the special rule for tuple
syntax. Sorry!

Perhaps you can file it as a Sourceforge bug. I'm going to do a raft of
changes to GADTs in the autumn, and by filing it you'll ensure I don't
forget.

BTW, what are you using GADTs for? Any other unexpected surprises?

Thanks

Simon


| -----Original Message-----
| From: glasgow-haskell-bugs-bounces@xxxxxxxxxxx
[mailto:glasgow-haskell-bugs-
| bounces@xxxxxxxxxxx] On Behalf Of Arthur Baars
| Sent: 06 September 2005 16:48
| To: glasgow-haskell-bugs@xxxxxxxxxxx
| 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'
|
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs@xxxxxxxxxxx
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


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

News | FAQ | advertise