X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FOrd.hs;h=fd291ae960e8ddfe6899c934c83fb2e828535574;hb=HEAD;hp=2be636c213af963a494f8e6e3cfab534f90a2693;hpb=41f0208eabdb92852b6e463406aca68d32e08d8c;p=ghc-base.git diff --git a/Data/Ord.hs b/Data/Ord.hs index 2be636c..fd291ae 100644 --- a/Data/Ord.hs +++ b/Data/Ord.hs @@ -1,4 +1,5 @@ -{-# OPTIONS_GHC -fno-implicit-prelude #-} +{-# LANGUAGE CPP, NoImplicitPrelude #-} + ----------------------------------------------------------------------------- -- | -- Module : Data.Ord @@ -15,7 +16,7 @@ module Data.Ord ( Ord(..), - Ordering, + Ordering(..), comparing, ) where @@ -23,5 +24,12 @@ module Data.Ord ( import GHC.Base #endif +-- | +-- > 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) ... comparing :: (Ord a) => (b -> a) -> b -> b -> Ordering comparing p x y = compare (p x) (p y)