
Message: 6
Date: Mon, 26 Sep 2011 05:53:05 +0200 From: Daniel Fischer
Subject: Proposal: New Eq and Ord instances for Double and Float To: libraries@haskell.org Message-ID: <201109260553.05083.daniel.is.fischer@googlemail.com> Content-Type: Text/Plain; charset="us-ascii" Proposal: Provide Double and Float with Eq and Ord instances that introduce a total order.
With the current behavior, other data structures (e.g. Data.Set Float) can be corrupted by NaN. Silent corruption is an unforgivable sin, and I think it's worth giving up IEEE semantics for default comparisons to fix it. Especially since IEEE floats are often poorly-understand, it's an easy trap for the unwary, or even the cautious, programmer. My biggest concern is for the Haskell community at large. How many current programs expect (or rely upon) IEEE behavior? The impact of this change could be extremely wide-ranging. I would expect a major version bump to base to implement this, solely due to the impact. As to what symbol to use for IEEE comparisons, I dislike the OCaml dot-style operators precisely because it's easy to overlook. I don't have a nice justification for it, but how about two dots, e.g. "==..", ">.." ? John L