base-compat-0.7.1: A compatibility layer for base

Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Ord.Compat

Synopsis

Documentation

class Eq a => Ord a where

The Ord class is used for totally ordered datatypes.

Instances of Ord can be derived for any user-defined datatype whose constituent types are in Ord. The declared order of the constructors in the data declaration determines the ordering in derived Ord instances. The Ordering datatype allows a single comparison to determine the precise ordering of two objects.

Minimal complete definition: either compare or <=. Using compare can be more efficient for complex types.

Minimal complete definition

compare | (<=)

Methods

compare :: a -> a -> Ordering

(<) :: a -> a -> Bool infix 4

(>=) :: a -> a -> Bool infix 4

(>) :: a -> a -> Bool infix 4

(<=) :: a -> a -> Bool infix 4

max :: a -> a -> a

min :: a -> a -> a

Instances

Ord Bool 
Ord Char 
Ord Double 
Ord Float 
Ord Int 
Ord Integer 
Ord Ordering 
Ord Word 
Ord Word8 
Ord Word16 
Ord Word32 
Ord Word64 
Ord () 
Ord Version 
Ord AsyncException 
Ord ArrayException 
Ord ExitCode 
Ord BufferMode 
Ord Newline 
Ord NewlineMode 
Ord WordPtr 
Ord IntPtr 
Ord CChar 
Ord CSChar 
Ord CUChar 
Ord CShort 
Ord CUShort 
Ord CInt 
Ord CUInt 
Ord CLong 
Ord CULong 
Ord CLLong 
Ord CULLong 
Ord CFloat 
Ord CDouble 
Ord CPtrdiff 
Ord CSize 
Ord CWchar 
Ord CSigAtomic 
Ord CClock 
Ord CTime 
Ord CUSeconds 
Ord CSUSeconds 
Ord CIntPtr 
Ord CUIntPtr 
Ord CIntMax 
Ord CUIntMax 
Ord ErrorCall 
Ord ArithException 
Ord All 
Ord Any 
Ord Arity 
Ord Fixity 
Ord Associativity 
Ord a => Ord [a] 
Integral a => Ord (Ratio a) 
Ord (Ptr a) 
Ord (FunPtr a) 
Ord (U1 p) 
Ord p => Ord (Par1 p) 
Ord a => Ord (ZipList a) 
Ord a => Ord (Dual a) 
Ord a => Ord (Sum a) 
Ord a => Ord (Product a) 
Ord a => Ord (First a) 
Ord a => Ord (Last a) 
Ord a => Ord (Down a) 
Ord a => Ord (Maybe a) 
(Ord a, Ord b) => Ord (Either a b) 
Ord (f p) => Ord (Rec1 f p) 
(Ord a, Ord b) => Ord (a, b) 
(Ix i, Ord e) => Ord (Array i e) 
Ord a => Ord (Const a b) 
Ord (Proxy k s) 
Ord c => Ord (K1 i c p) 
(Ord (f p), Ord (g p)) => Ord ((:+:) f g p) 
(Ord (f p), Ord (g p)) => Ord ((:*:) f g p) 
Ord (f (g p)) => Ord ((:.:) f g p) 
(Ord a, Ord b, Ord c) => Ord (a, b, c) 
Ord ((:~:) k a b) 
Ord (f a) => Ord (Alt k f a) 
Ord (f p) => Ord (M1 i c f p) 
(Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d) 
(Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => Ord (a, b, c, d, e, f, g, h) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => Ord (a, b, c, d, e, f, g, h, i) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j) => Ord (a, b, c, d, e, f, g, h, i, j) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k) => Ord (a, b, c, d, e, f, g, h, i, j, k) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l) => Ord (a, b, c, d, e, f, g, h, i, j, k, l) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 

newtype Down a :: * -> *

The Down type allows you to reverse sort order conveniently. A value of type Down a contains a value of type a (represented as Down a). If a has an Ord instance associated with it then comparing two values thus wrapped will give you the opposite of their normal sort order. This is particularly useful when sorting in generalised list comprehensions, as in: then sortWith by Down x

Provides Show and Read instances (since: 4.7.0.0).

Since: 4.6.0.0

Constructors

Down a 

Instances

Eq a => Eq (Down a) 
Ord a => Ord (Down a) 
Read a => Read (Down a) 
Show a => Show (Down a)