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: [EMAIL PROTECTED] [mailto:glasgow-haskell-bugs- | [EMAIL PROTECTED] On Behalf Of Arthur Baars | Sent: 06 September 2005 16:48 | To: [email protected] | 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 | [email protected] | http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs _______________________________________________ Glasgow-haskell-bugs mailing list [email protected] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
