[Haskell-cafe] Re: (flawed?) benchmark : sort
ndmitchell at gmail.com
Mon Mar 10 09:32:41 EDT 2008
> 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.
More information about the Haskell-Cafe