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

Stephen Forrest stephen.forrest at gmail.com
Mon Apr 10 01:22:04 EDT 2006


On 4/7/06, Jared Updike <jupdike at gmail.com> wrote:
> > given an Ord instance (for a type T) a corresponding Eq instance can be
> > given by:
> >
> > instance Eq T where
> >     a == b = compare a b == EQ
>
> where did this second -----^ == come from? (I guess if if Ordering
> derives Eq :-) I think you meant

I think another poster essentially already said this, but the second
== comes from the Eq instance for type Ordering, which is in the
Prelude.  So this we can actually rely on.

Steve


More information about the Haskell-Cafe mailing list