3 May
2001
3 May
'01
8:57 a.m.
At 2001-05-03 01:42, Simon Peyton-Jones wrote:
| 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:
Hmm...
* the class says a->b
Yes.
* the instance matches any first arg
I was rather hoping that the instance would match only (Num a => a) rather than (a).
and says that the second must be equal.
Yes. -- Ashley Yakeley, Seattle WA