1 {-# LANGUAGE CPP, NoImplicitPrelude #-}
3 -----------------------------------------------------------------------------
6 -- Copyright : (c) The University of Glasgow 2005
7 -- License : BSD-style (see the file libraries/base/LICENSE)
9 -- Maintainer : libraries@haskell.org
11 -- Portability : portable
15 -----------------------------------------------------------------------------
23 #if __GLASGOW_HASKELL__
28 -- > comparing p x y = compare (p x) (p y)
30 -- Useful combinator for use in conjunction with the @xxxBy@ family
31 -- of functions from "Data.List", for example:
33 -- > ... sortBy (comparing fst) ...
34 comparing :: (Ord a) => (b -> a) -> b -> b -> Ordering
35 comparing p x y = compare (p x) (p y)