edited tags
Link
Source Link
Eyvind
  • 133
  • 3

Confusing (to me) statement from "Type Classes in Haskell"

I'm reading up on type classes, and started looking at the paper Type Classes in Haskell.

In Section 2.2 - Superclasses, the authors use the following example:

class (Eq a) => Ord a where 
   (<)  :: a -> a -> Bool
   (<=) :: a -> a -> Bool

Then, they proceed to state that "This declares that type a belongs to class Ord if there are operations (<) and (<=) of the appropriate type and if a belongs to class Eq. Thus, if (<) is defined on some type, then (==) must be defined on that type as well."

The second sentence does not make any sense to me; why would a type that defines (<) have to define (==) if it is not declared to be an instance of either Ord or Eq?