[Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?
Mike Meyer
mwm
Wed Oct 2 18:39:18 UTC 2013
On Wed, Oct 2, 2013 at 5:18 AM, Tom Ellis <
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:
> Are there examples where application programmers would like there so be
some
> f, a and b such that a == b but f a /= f b (efficiency concerns aside)? I
> can't think of any obvious ones.
Yes, and we already handle it properly:
Prelude> let f = (1.0 /)
Prelude> let (z, negz) = (0.0, -0.0)
Prelude> z == negz
True
Prelude> f z /= f negz
True
This is *not* an "IEEE Floats are weird" thing. Application
programmers want 0.0 to equal -0.0, but -Infinity to not be equal to
Infinity.
Of course, given how many "IEEE Floats are weird" things there are,
you can reasonably consider ignoring this example.
<mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131002/a73850a6/attachment.htm>
More information about the Haskell-Cafe
mailing list