Proposal (long term): Remove (/=) from Eq; change the semantics of (==) for floating point

Herbert Valerio Riedel hvr at
Thu Sep 25 09:38:37 UTC 2014

On 2014-09-25 at 05:25:02 +0200, David Feuer wrote:
> As Edward Kmett explained to me, (/=) is currently needed in Eq to support
> IEEE floating point semantics for (==) and (/=). As I see it, those
> semantics are badly broken from the perspective of what Eq is supposed to
> mean, and really should be supported using special functions (eqIEEE and
> neqIEEE or whatever), whereas the most appropriate Eq instance for floating
> point would be something more like

If the Eq instance for Double is changed, what about its Ord instance
then? Right now, (0/0::Double) is handled poorly for both Eq and Ord,
resulting in Data.Map and other operations relying on Eq/Ord to behave
weirdly when (0/0::Double) happens to be used as key.

More information about the Libraries mailing list