[Haskell-cafe] instance Enum Double considered not entirely great?
Felipe Almeida Lessa
felipe.lessa at gmail.com
Wed Sep 21 06:00:22 CEST 2011
On Wed, Sep 21, 2011 at 12:47 AM, Richard O'Keefe <ok at cs.otago.ac.nz> wrote:
> In any mathematical partial order, we expect
> x `le` x
> to be a law. But in IEEE arithmetic, if x is a NaN, x `le` x is
> false. I don't see how to reconcile these.
>
> I agree that a standard partial order class would be nice.
logfloat package's PartialOrd solution is to have
le :: PartialOrd a => a -> a -> Maybe Bool
In IEEE arithmetic, if x is a NaN and y is anything else, x `le` y ==
y `le` x == Nothing.
Cheers,
--
Felipe.
More information about the Haskell-Cafe
mailing list