Skip to content

Ord

Ord is a subclass of Eq. It's the class of all types whose values can be compared, that have an ordering defined on them. Again, we discussed it earlier in this chapter.

GHCi
>>> :info Ord
type Ord :: * -> Constraint
class Eq a => Ord a where
  compare :: a -> a -> Ordering
  (<) :: a -> a -> Bool
  (<=) :: a -> a -> Bool
  (>) :: a -> a -> Bool
  (>=) :: a -> a -> Bool
  max :: a -> a -> a
  min :: a -> a -> a
  {-# MINIMAL compare | (<=) #-}
    -- Defined in ‘GHC.Classes’
[More omitted output]