[Haskell-cafe] Ord methods too strict?

Isaac Elliott isaace71295 at gmail.com
Wed Jan 2 10:29:51 UTC 2019

One of the relationships implied by the Ord typeclass is:

a <= b = True  iff  compare a b = EQ \/ compare a b = LT

If we write an alternative definition of (<=) that is only strict in its
first argument:

False <= _ = True
True <= x = x

Then it's impossible to write `compare` in a way that's consistent with
that relation.

More concretely, it's likely that Ord Bool is defined via `compare`, which
is necessarily strict in both arguments.

On Wed, 2 Jan. 2019, 7:47 pm V.Liepelt, <V.Liepelt at kent.ac.uk> wrote:

> I am surprised to find that `False <= undefined = undefined`.
> What justifies (<=) to be strict in both arguments?
> Vilem
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190102/3e5ed8ec/attachment.html>

More information about the Haskell-Cafe mailing list