Re: fundeps question
16 Dec
2002
16 Dec
'02
1:43 a.m.
At 2002-12-14 15:27, nalexand@gianther.hypbus.com wrote:
I define
class Mul a b c | a b -> c, b a -> c where mul :: a -> b -> c
The two constraints are identical. Each one says "given a and b, you have c". What you want is essentially this: class (Mul b a c) => Mul a b c where mul :: a -> b -> c mul a b = mul b a ...but that's not allowed as superclass contexts cannot be circular.
I want
instance (Mul a b c) => Mul b a c where mul x y = mul y x
This will overlap with any other "Mul" instance. Instance declarations cannot be made overridable the way functions in OOP languages can be: each instance declaration must have an entirely separate domain. -- Ashley Yakeley, Seattle WA
8656
Age (days ago)
8656
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ashley Yakeley