projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add GHC.HetMet.{hetmet_kappa,hetmet_kappa_app}
[ghc-base.git]
/
Data
/
Ord.hs
diff --git
a/Data/Ord.hs
b/Data/Ord.hs
index
2be636c
..
fd291ae
100644
(file)
--- a/
Data/Ord.hs
+++ b/
Data/Ord.hs
@@
-1,4
+1,5
@@
-{-# OPTIONS_GHC -fno-implicit-prelude #-}
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+
-----------------------------------------------------------------------------
-- |
-- Module : Data.Ord
-----------------------------------------------------------------------------
-- |
-- Module : Data.Ord
@@
-15,7
+16,7
@@
module Data.Ord (
Ord(..),
module Data.Ord (
Ord(..),
- Ordering,
+ Ordering(..),
comparing,
) where
comparing,
) where
@@
-23,5
+24,12
@@
module Data.Ord (
import GHC.Base
#endif
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)
comparing :: (Ord a) => (b -> a) -> b -> b -> Ordering
comparing p x y = compare (p x) (p y)