never executed always true always false
1 -- Some extra functions to extend Data.Map
2
3 module GHC.Data.FiniteMap (
4 insertList,
5 insertListWith,
6 deleteList,
7 foldRight, foldRightWithKey
8 ) where
9
10 import GHC.Prelude
11
12 import Data.Map (Map)
13 import qualified Data.Map as Map
14
15 insertList :: Ord key => [(key,elt)] -> Map key elt -> Map key elt
16 insertList xs m = foldl' (\m (k, v) -> Map.insert k v m) m xs
17
18 insertListWith :: Ord key
19 => (elt -> elt -> elt)
20 -> [(key,elt)]
21 -> Map key elt
22 -> Map key elt
23 insertListWith f xs m0 = foldl' (\m (k, v) -> Map.insertWith f k v m) m0 xs
24
25 deleteList :: Ord key => [key] -> Map key elt -> Map key elt
26 deleteList ks m = foldl' (flip Map.delete) m ks
27
28 foldRight :: (elt -> a -> a) -> a -> Map key elt -> a
29 foldRight = Map.foldr
30 foldRightWithKey :: (key -> elt -> a -> a) -> a -> Map key elt -> a
31 foldRightWithKey = Map.foldrWithKey