
10 Mar
2008
10 Mar
'08
9:32 a.m.
Hi
The Eq instance you've given violates the law that (x == y) = True implies x = y. Of course the Haskell standard doesn't specify this law, but it should.
Wrong. It shouldn't, it doesn't, and I don't think it even can!
The Haskell standard doen't even specify that compare x y = EQ implies (x == y) = True, but again it should (what's the purpose of the Eq constraint on Ord class otherwise).
Correct. Yes, this is one law that _should_ be true, along with others: a > b && b > c => a > c a == b => b == a etc. But a == b => a = b is not a law that needs to hold, and not a law that can be stated in Haskell, even as a quickcheck property. Thanks Neil