[Haskell-cafe] Mystery of an Eq instance
Bardur Arantsson
spam at scientician.net
Sat Sep 21 09:21:37 CEST 2013
On 2013-09-21 06:16, Mike Meyer wrote:
> The single biggest gotcha is that two calculations
> we expect to be equal often aren't. As a result of this, we warn
> people not to do equality comparison on floats.
The Eq instance for Float violates at least one expected law of Eq:
Prelude> let nan = 0/0
Prelude> nan == nan
False
There was a proposal to change this, but it didn't really go anywhere. See:
http://permalink.gmane.org/gmane.comp.lang.haskell.libraries/16218
(FWIW, even if the instances cannot be changed/removed, I'd love to see
some sort of explicit opt-in before these dangerous/suprising instances
become available.)
Regards,
More information about the Haskell-Cafe
mailing list