Ord lets a type support comparisons such as < and >=. It extends Eq, so an Ord implementation must also define equality; compare provides the ordering used by several default methods. section 7.1 section 7.1.5
interface Eq ty => Ord ty where #1 compare : ty -> ty -> Ordering #2 (<) : ty -> ty -> Bool (>) : ty -> ty -> Bool (<=) : ty -> ty -> Bool (>=) : ty -> ty -> Bool max : ty -> ty -> ty #3 min : ty -> ty -> ty #4
The interface signature shows compare returning Ordering alongside comparison operators, max, and min. section 7.1.5
Ordering albums
An Album record can be ordered by artist, then release year, then title when the earlier fields match. After defining Eq and Ord for Album, sort can order a list of albums; without that implementation, Idris reports that it cannot find Ord Album. section 7.1.5
