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

John Meacham john at repetae.net
Thu Apr 6 17:01:36 EDT 2006

On Thu, Apr 06, 2006 at 09:31:24PM +0100, Brian Hulley wrote:
> I've been wondering for a long time if there is a reason why Ord should
> inherit from Eq and not vice versa, or whether in fact there is any
> justification for making either Ord or Eq inherit from the other one.

The problem is that having an order implies you have equality, so
deriving Eq from Ord won't actually mean anything.

a == b = a <= b && b <= a

that and there are many things that have an equivalance relationship on
them, but no total ordering.

as to why there isn't a partial ordering class between Eq and Ord, that
is a good question.

in haskell classes _do_ define interfaces, not concrete representations
so the problems with inherentence of non-abstract classes in OO
languages don't apply.


John Meacham - ⑆repetae.net⑆john⑈

More information about the Haskell-Cafe mailing list