Newtype wrapper for Float/Double with sensible Eq/Ord instances

Zemyla zemyla at
Sat Nov 30 16:21:20 UTC 2019

There should be a newtype wrapper that wraps a RealFloat, keeps the
Enum/Num/Fractional/so on instances, but gives it sensible ones for Eq and
Ord, with the following order:

NaN < -Inf < negative < -0 < +0 < positive < +Inf

It may not belong in base, but if nothing else it definitely belongs in
containers, because Set and Map depend critically on sensible instances of

(Also, it should newtype derive Read and Show, so that people using them
with GHCi see "fromList [(NaN, yadda), (-1.5, yadda), (2.7, blah), (+Inf,
blah)]" instead of "fromList [(FloatOrd { unwrapFloat :: NaN }, yadda),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list