On Monday 16 December 2002 18:18, Ashley Yakeley wrote:
In article [EMAIL PROTECTED],
Hal Daume III [EMAIL PROTECTED] wrote:
I spent about a half hour toying around with this and came up with the
following, which seems to work (in ghci, but not hugs -- question for
smart people: which is
Hi,
I spent about a half hour toying around with this and came up with the
following, which seems to work (in ghci, but not hugs -- question for
smart people: which is correct, if either?)...
class Mul a b c | a b - c where
mul :: a - b - c-- our standard multiplication, with fundeps
In article [EMAIL PROTECTED],
Hal Daume III [EMAIL PROTECTED] wrote:
I spent about a half hour toying around with this and came up with the
following, which seems to work (in ghci, but not hugs -- question for
smart people: which is correct, if either?)...
Both are correct. Hugs fails
I want to use functional dependencies in a way I've not yet seen: to enforce
commutativity.
I define
class Mul a b c | a b - c, b a - c where mul :: a - b - c
I want
instance (Mul a b c) = Mul b a c where mul x y = mul y x
do what I expect: if I can multiply a and b, then I can multiply b
At 2002-12-14 15:27, [EMAIL PROTECTED] 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