Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Additional functions for manipulating Map
s.
Synopsis
- diffMapNoEq :: Ord k => Map k v -> Map k v -> Map k (Maybe v)
- diffMap :: (Ord k, Eq v) => Map k v -> Map k v -> Map k (Maybe v)
- applyMap :: Ord k => Map k (Maybe v) -> Map k v -> Map k v
- mapPartitionEithers :: Map k (Either a b) -> (Map k a, Map k b)
- applyMapKeysSet :: Ord k => Map k (Maybe v) -> Set k -> Set k
Working with Maps
diffMapNoEq :: Ord k => Map k v -> Map k v -> Map k (Maybe v) Source #
Produce a
by comparing two Map
k (Maybe v)
s, Map
k vold
and new
respectively. Just
represents an association present in new
and Nothing
represents an association only present in old
but no longer present in new
.
Similar to diffMap
but doesn't require Eq
on the values, thus can't tell if a value has changed or not.
diffMap :: (Ord k, Eq v) => Map k v -> Map k v -> Map k (Maybe v) Source #
Produce a
by comparing two Map
k (Maybe v)
s, Map
k vold
and new respectively.
Just represents an association present in
new and either not
present in
old or where the value has changed.
Nothing represents an association only present in
old but no longer present in
new@.
See also diffMapNoEq
for a similar but weaker version which does not require Eq
on the values but thus can't indicated a value not changing between
old
and new
with Nothing
.
applyMap :: Ord k => Map k (Maybe v) -> Map k v -> Map k v Source #
Given a
representing keys to insert/update (Map
k (Maybe v)Just
) or delete (Nothing
), produce a new map from the given input
.Map
k v
See also Map
and MapWithMove
.