[Haskell-cafe] ordNub

oleg at okmij.org oleg at okmij.org
Thu Jan 1 13:58:35 UTC 2015

Tom Ellis wrote:
> Is there a type with an Eq instance for which on Ord instance could not also
> be provided (i.e. I'm interested in Clark's "converse")?

Of course. One of the very many examples is Complex. One can say we
can compare complex numbers, by their absolute value.  That is true;
however we end up in a position where compare x y returns EQ but x==y
returns False. 

In general, Ord represents total order. There are many structures on
which total order cannot be established. Take nodes in the tree, the
Tree data type. One can compare nodes by taking a parent to be less
than any of its children. But then two brothers are not
comparable. Searching for "partial orders" and pre-orders gives many
more examples.

More information about the Haskell-Cafe mailing list