[Haskell-cafe] ordNub

Atze van der Ploeg atzeus at gmail.com
Thu Jan 1 14:12:15 UTC 2015


Instance Ord a where
  _ <= _ = True

Is law abiding for any type. So there is no type that cannot support a law
abiding Ord instance.
On Jan 1, 2015 3:04 PM, "Tom Ellis" <
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:

> On Thu, Jan 01, 2015 at 08:58:35AM -0500, oleg at okmij.org wrote:
> > 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.
>
> I don't understand your objection.  `Complex a` isomorphic to `(a, a)`
> which
> can be totally ordered.  (The complex field cannot be given a total order
> *compatible with the field structure*, but that's not relevant to my
> question.)
>
> > 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.
>
> I think you may be missing the intent of my question.  I am merely asking
> whether there is a type which supports a (law abiding) Eq instance that
> cannot support a (law abiding) Ord instance.  Whether that Ord instance is
> compatible with additional structures on that type is beside the point.
>
> Tom
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20150101/c4eeba8d/attachment.html>


More information about the Haskell-Cafe mailing list