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

Remi Turk rturk at science.uva.nl
Tue Mar 11 16:33:33 EDT 2008


On Tue, Mar 11, 2008 at 01:43:36AM -0400, Brandon S. Allbery KF8NH wrote:
> On Mar 11, 2008, at 0:20 , Chaddaï Fouché wrote:
>> 2008/3/11, David Menendez <dave at zednenem.com>:
>>> I think Adrian is just arguing that a == b should imply f a == f b,
>>>  for all definable f, in which case it doesn't *matter* which of two
>>>  equal elements you choose, because there's no semantic difference.
>>>
>> I completely agree that this propriety should be true for all Eq
>> instance exported by a public module. I don't care if it is not the
>> case in a isolated code, but libraries shouldn't break expected
>> invariant (or at least be very cautious and warn the user). Even Eq
>> Double respects this propriety as far as I know.
>
> I wouldn't want to bet on that (Eq Double, that is).  Floating point's just 
> *evil*.

I wouldn't bet on it either:

Prelude> 0.0 == -0.0
True
Prelude> isNegativeZero 0.0 == isNegativeZero (-0.0)
False

Although isNegativeZero might be considered a ``private,
"internal" interface that exposes implementation details.''

Groeten, Remi


More information about the Haskell-Cafe mailing list