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

Adrian Hey ahey at iee.org
Mon Mar 10 10:10:52 EDT 2008

Neil Mitchell wrote:
> 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,

Should too

> it doesn't,


> and I don't think it even can!

Well we need to be precise about exactly what "=" means, but informally
I guess we're talking about observational equvalence.

But seriously, once you admit the possibility that even if x == y it
still matters which of x or y is used in expressions than all hell
breaks loose. I shudder to think just how much Haskell code there must
be out there that is (at best) ambiguious or just plain "broken" if
this is a serious possibility.

Again, I have to cite Data.Map as an obvious example. It's unclear
to me exactly what the proper interpretation of "left biasing" is
for all functions in the API. Furthermore, until quite recently some
function implementations in Data.Map we're actually broken wrt the
stated "biasing" policy (though few actually noticed this for obvious
reasons). Perhaps some still are? Who knows..

Adrian Hey

More information about the Haskell-Cafe mailing list