| In Hugs 98 Feb2001 (as hugs -98), this piece of code gives an error:
| 
| class X a b | a -> b where x :: a;
| class (X a b) => Y a b | a -> b where y :: a;
| instance (X a b) => Y a b where y = x;
| instance (Num a) => X a a where x = 0; -- line A

Quite right too!  The final instance declaration says that the two
arguments of X must always be the same:
        * the class says a->b
        * the instance matches any first arg and says that
          the second must be equal.

So when typechecking the instance for Y a b, a and b are forced
to be equal, and that's less general than the instance claims to
be.

Simon

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to