diff options
Diffstat (limited to 'src/GF/Data/Utilities.hs')
| -rw-r--r-- | src/GF/Data/Utilities.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/GF/Data/Utilities.hs b/src/GF/Data/Utilities.hs index c7e1600c3..e0ad08705 100644 --- a/src/GF/Data/Utilities.hs +++ b/src/GF/Data/Utilities.hs @@ -99,6 +99,11 @@ tableSet x y [] = [(x,y)] tableSet x y (p@(x',_):xs) | x' == x = (x,y):xs | otherwise = p:tableSet x y xs +-- | Group tuples by their first elements. +buildMultiMap :: Ord a => [(a,b)] -> [(a,[b])] +buildMultiMap = map (\g -> (fst (head g), map snd g) ) + . sortGroupBy (compareBy fst) + -- * equality functions -- | Use an ordering function as an equality predicate. |
