Re: fundeps question

2002-12-17 Thread Jeffrey R Lewis
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

Re: fundeps question

2002-12-16 Thread Hal Daume III
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

Re: fundeps question

2002-12-16 Thread Ashley Yakeley
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

fundeps question

2002-12-15 Thread nalexand
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

Re: fundeps question

2002-12-15 Thread Ashley Yakeley
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