[Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

Stijn van Drongelen rhymoid
Wed Oct 2 13:51:43 UTC 2013


On Wed, Oct 2, 2013 at 3:49 PM, Niklas Haas <haskell at nand.wakku.to> wrote:

> On Wed, 2 Oct 2013 15:46:42 +0200, Stijn van Drongelen <rhymoid at gmail.com>
> wrote:
> > I do think something has to be done to have an Eq and Ord with more
> strict
> > laws.
> >
> > * Operators in Eq and Ord diverge iff any of their parameters are bottom.
> > * The default definitions of (/=), (<), (>) and `compare` are law.
> > * (==) is reflexive and transitive
> > * (<=) is antisymmetric ((x <= y && y <= x) `implies` (x == y))
> > * (<=) is 'total' (x <= y || y <= x)
> > * (<=) is transitive
> >
> > Currently, reflexivity of (==) is broken in the Prelude (let x = 0/0 in x
> > == x). I know this is for IEEE 754 compliance, but c'mon, this is
> Haskell,
> > we can have better ways of dealing with NaNs.
>
> Like making Double not be an instance of Eq?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

Like making IEEE754 Doubles not an instance of Eq. Normal and denormal
Doubles should have Eq instances.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131002/65ce915d/attachment.htm>



More information about the Haskell-Cafe mailing list