[Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?
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
> 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
Prelude> f z /= f negz
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
Of course, given how many "IEEE Floats are weird" things there are,
you can reasonably consider ignoring this example.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe