Proposal: New Eq and Ord instances for Double and Float

Daniel Peebles pumpkingod at gmail.com
Mon Sep 26 07:23:09 CEST 2011


Oh actually, (I think) I was wrong about us violating the laws (if you
ignore the compare method's implied meaning). It does, however, violate any
kinds of laws we might have for Ord, where compare should agree with the
Bool comparison operators, and e.g. min/max should be commutative.

Basically, I don't think we should be held back by shitty conventions that
other languages (or standards bodies) introduced. It's not like you're
really *supposed* to be comparing vanilla Floats/Doubles, so most people try
to avoid it anyway. The scheme in this proposal would remove one of the
reasons it's usually nonsensical to compare them directly, if anything.

I'm in favor, but not strongly so. I just think it's an ugly wart on the
language that doesn't really buy us much beyond compliance with a flawed
standard.

On Mon, Sep 26, 2011 at 1:10 AM, Daniel Peebles <pumpkingod at gmail.com>wrote:

> Is it? our Ord class already violates the IEEE spec (and can't help it), so
> we might as well violate it and be mathematically useful.
>
> On Mon, Sep 26, 2011 at 1:05 AM, Bryan O'Sullivan <bos at serpentine.com>wrote:
>
>> On Sun, Sep 25, 2011 at 10:53 PM, Daniel Fischer <
>> daniel.is.fischer at googlemail.com> wrote:
>>
>>> Proposal: Provide Double and Float with Eq and Ord instances that
>>> introduce
>>> a total order.
>>>
>>
>> I am strongly against this proposal, as it is in an area that is
>> particularly poorly understood by most programmers (even experts). While the
>> current behaviour may be undesirable from some points of view, at least it
>> is consistent with most other programming languages - and this is one of the
>> few areas where I think that's important.
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110926/89ce9085/attachment.htm>


More information about the Libraries mailing list