diff options
Diffstat (limited to 'src/GF/Data/Utilities.hs')
| -rw-r--r-- | src/GF/Data/Utilities.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/GF/Data/Utilities.hs b/src/GF/Data/Utilities.hs index e0ad08705..74d3ef81e 100644 --- a/src/GF/Data/Utilities.hs +++ b/src/GF/Data/Utilities.hs @@ -104,6 +104,10 @@ buildMultiMap :: Ord a => [(a,b)] -> [(a,[b])] buildMultiMap = map (\g -> (fst (head g), map snd g) ) . sortGroupBy (compareBy fst) +-- | Replace all occurences of an element by another element. +replace :: Eq a => a -> a -> [a] -> [a] +replace x y = map (\z -> if z == x then y else z) + -- * equality functions -- | Use an ordering function as an equality predicate. |
