From eeb833ca43b3c8c6b78d59b708b45abf9ade9b36 Mon Sep 17 00:00:00 2001 From: bringert Date: Wed, 14 Sep 2005 17:00:19 +0000 Subject: Started wotking on NFA to DFA. --- src/GF/Data/Utilities.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/GF/Data') 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) -- cgit v1.2.3