[Haskell-cafe] Re: (flawed?) benchmark : sort

Neil Mitchell ndmitchell at gmail.com
Mon Mar 10 09:32:41 EDT 2008


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


More information about the Haskell-Cafe mailing list