From fd0dfd7d4d9885b8b4cac7bd60308e2890a05caa Mon Sep 17 00:00:00 2001 From: bringert Date: Wed, 1 Feb 2006 16:23:14 +0000 Subject: First version of SRGS with semantic tags. --- src/GF/Data/Utilities.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/GF/Data/Utilities.hs') diff --git a/src/GF/Data/Utilities.hs b/src/GF/Data/Utilities.hs index aaadad1fe..c7e1600c3 100644 --- a/src/GF/Data/Utilities.hs +++ b/src/GF/Data/Utilities.hs @@ -73,7 +73,12 @@ sortNub = map head . group . sort -- | Like 'nubBy', but more efficient as it uses sorting internally. sortNubBy :: (a -> a -> Ordering) -> [a] -> [a] -sortNubBy f = map head . groupBy (compareEq f) . sortBy f +sortNubBy f = map head . sortGroupBy f + +-- | Sorts and then groups elements given and ordering of the +-- elements. +sortGroupBy :: (a -> a -> Ordering) -> [a] -> [[a]] +sortGroupBy f = groupBy (compareEq f) . sortBy f -- | Take the union of a list of lists. unionAll :: Eq a => [[a]] -> [a] -- cgit v1.2.3