[Haskell-cafe] Justification for Ord inheriting from Eq?

Stephen Forrest stephen.forrest at gmail.com
Thu Apr 6 21:53:24 EDT 2006

On 4/6/06, Brian Hulley <brianh at metamilk.com> wrote:
> What about:
> class Eq a where (==), (/=) :: ...
> class PartialOrd a where
>      (<), (>) :: a->a->Bool
>      x > y = y < x
> class (PartialOrd a) => TotalOrd a where x <= y = not (y < x) ....
>    -- => not meaning inheritance but just a restriction on a for use of
> TotalOrd

A partial order can be defined in either of two ways, both of which
require some notion of equality.  If it is a weak partial order, you
need to require reflexivity, i.e. x=y implies R(x,y).  If it is a
strong partial order, you need to require irreflexivity.  So some
notion of equality is necessary in either case.  (I think the same is
true of preorders, if we want to generalize to that.)

So, if such a PartialOrd existed, it really should be between Eq and
Ord in the class hierarchy.


More information about the Haskell-Cafe mailing list