1 {-# OPTIONS_GHC -XNoImplicitPrelude #-}
2 -----------------------------------------------------------------------------
5 -- Copyright : (c) The University of Glasgow 2005
6 -- License : BSD-style (see the file libraries/base/LICENSE)
8 -- Maintainer : libraries@haskell.org
10 -- Portability : portable
14 -----------------------------------------------------------------------------
22 #if __GLASGOW_HASKELL__
27 -- > comparing p x y = compare (p x) (p y)
29 -- Useful combinator for use in conjunction with the @xxxBy@ family
30 -- of functions from "Data.List", for example:
32 -- > ... sortBy (comparing fst) ...
33 comparing :: (Ord a) => (b -> a) -> b -> b -> Ordering
34 comparing p x y = compare (p x) (p y)