projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
41f0208
)
[project @ 2005-03-14 15:52:03 by simonmar]
author
simonmar
<unknown>
Mon, 14 Mar 2005 15:52:03 +0000
(15:52 +0000)
committer
simonmar
<unknown>
Mon, 14 Mar 2005 15:52:03 +0000
(15:52 +0000)
doc comparing
Data/Ord.hs
patch
|
blob
|
history
diff --git
a/Data/Ord.hs
b/Data/Ord.hs
index
2be636c
..
b2f00f9
100644
(file)
--- a/
Data/Ord.hs
+++ b/
Data/Ord.hs
@@
-23,5
+23,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)