summaryrefslogtreecommitdiff
path: root/src/GF/Data
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Data')
-rw-r--r--src/GF/Data/Utilities.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/GF/Data/Utilities.hs b/src/GF/Data/Utilities.hs
index f32e43af3..7bc5040fd 100644
--- a/src/GF/Data/Utilities.hs
+++ b/src/GF/Data/Utilities.hs
@@ -4,9 +4,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/09/14 15:17:29 $
+-- > CVS $Date: 2005/09/14 18:00:19 $
-- > CVS $Author: bringert $
--- > CVS $Revision: 1.3 $
+-- > CVS $Revision: 1.4 $
--
-- Basic functions not in the standard libraries
-----------------------------------------------------------------------------
@@ -85,6 +85,14 @@ unionAll = nub . concat
lookup' :: Eq a => a -> [(a,b)] -> b
lookup' x = fromJust . lookup x
+-- * ordering functions
+
+compareBy :: Ord b => (a -> b) -> a -> a -> Ordering
+compareBy f = both f compare
+
+both :: (a -> b) -> (b -> b -> c) -> a -> a -> c
+both f g x y = g (f x) (f y)
+
-- * functions on pairs
mapFst :: (a -> a') -> (a, b) -> (a', b)