base-4.3.1.0: Basic libraries

Portabilityportable
Stabilitystable
Maintainerlibraries@haskell.org

Data.Ord

Description

Orderings

Synopsis

Documentation

class Eq a => Ord a whereSource

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.

Methods

compare :: a -> a -> Ordering Source

(<) :: a -> a -> Bool Source

(>=) :: a -> a -> Bool Source

(>) :: a -> a -> Bool Source

(<=) :: a -> a -> Bool Source

max :: a -> a -> aSource

min :: a -> a -> aSource

Instances

Ord ()
Ord Unique
Ord a => Ord [a]
Integral a => Ord (Ratio a)
Ord (Ptr a)
Ord (FunPtr a)
Ord a => Ord ([::] a)
Ord a => Ord (Maybe a)
Ord a => Ord (Last a)
Ord a => Ord (First a)
Ord a => Ord (Product a)
Ord a => Ord (Sum a)
Ord a => Ord (Dual a)
Ord a => Ord (Down a)
Ord (Fixed a)
(Ord a, Ord b) => Ord (Either a b)
(Ord a, Ord b) => Ord (a, b)
(Ix i, Ord e) => Ord (Array i e)
(Ord a, Ord b, Ord c) => Ord (a, b, c)
(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)

data Ordering Source

Constructors

LT
EQ
GT

Instances

comparing :: Ord a => (b -> a) -> b -> b -> Ordering Source

 comparing p x y = compare (p x) (p y)

Useful combinator for use in conjunction with the xxxBy family of functions from Data.List, for example:

 ... sortBy (comparing fst) ...

AltStyle によって変換されたページ (->オリジナル) /