summaryrefslogtreecommitdiff
path: root/src/GF/Data
diff options
context:
space:
mode:
authorbringert <unknown>2005-09-14 17:00:19 +0000
committerbringert <unknown>2005-09-14 17:00:19 +0000
commiteeb833ca43b3c8c6b78d59b708b45abf9ade9b36 (patch)
treefd19813779721f6998ff248f98d8c0a1db61d6da /src/GF/Data
parente3395efbf18757f16e32035f4259e47aced6da27 (diff)
Started wotking on NFA to DFA.
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)