490d6be55d55bb76cb6f3d4c3de27bba002cd3ae
[ghc-base.git] / Data / Ord.hs
1 {-# OPTIONS_GHC -fno-implicit-prelude #-}
2 -----------------------------------------------------------------------------
3 -- |
4 -- Module      :  Data.Ord
5 -- Copyright   :  (c) The University of Glasgow 2005
6 -- License     :  BSD-style (see the file libraries/base/LICENSE)
7 -- 
8 -- Maintainer  :  libraries@haskell.org
9 -- Stability   :  stable
10 -- Portability :  portable
11 --
12 -- Orderings
13 --
14 -----------------------------------------------------------------------------
15
16 module Data.Ord (
17    Ord(..),
18    Ordering(..),
19    comparing,
20  ) where
21
22 #if __GLASGOW_HASKELL__
23 import GHC.Base
24 #endif
25
26 -- | 
27 -- > comparing p x y = compare (p x) (p y)
28 --
29 -- Useful combinator for use in conjunction with the @xxxBy@ family
30 -- of functions from "Data.List", for example:
31 --
32 -- >   ... sortBy (comparing fst) ...
33 comparing :: (Ord a) => (b -> a) -> b -> b -> Ordering
34 comparing p x y = compare (p x) (p y)