fromListWithL : Ordk => (v -> v -> v) -> [(k, v)] -> MapkvCreate a map from a list of key/value pairs with a combining
function. The combining function is only used when a key appears multiple
times in the list and it takes two arguments: the first one is the new value
being inserted at that key and the second one is the value accumulated so
far at that key.
Examples:
fromListWithR : Ordk => (v -> v -> v) -> [(k, v)] -> MapkvCreate a map from a list of key/value pairs like fromListWithL
with the combining function flipped. Examples:
keys : Mapkv -> [k]Get the list of keys in the map. Keys are sorted according to the
built-in order for the type k, which matches the Ord k instance
when using deriving Ord.
insert : Ordk => k -> v -> Mapkv -> MapkvInsert a new key/value pair in the map. If the key is already
present in the map, the associated value is replaced with the
supplied value.
insertWith : Ordk => (v -> v -> v) -> k -> v -> Mapkv -> MapkvInsert a new key/value pair in the map. If the key is already
present in the map, it is combined with the previous value using the given function
f new_value old_value.
alter : Ordk => (Optionalv -> Optionalv) -> k -> Mapkv -> MapkvUpdate the value in m at k with f, inserting or deleting as
required. f will be called with either the value at k, or None
if absent; f can return Some with a new value to be inserted in
m (replacing the old value if there was one), or None to remove
any k association m may have.Some implications of this behavior:alter identity k = identity
alter g k . alter f k = alter (g . f) k
alter (_ -> Some v) k = insert k v
alter (_ -> None) = delete
unionWith : Ordk => (v -> v -> v) -> Mapkv -> Mapkv -> MapkvThe union of two maps using the combining function to merge values that
exist in both maps.
merge : Ordk => (k -> a -> Optionalc) -> (k -> b -> Optionalc) -> (k -> a -> b -> Optionalc) -> Mapka -> Mapkb -> MapkcCombine two maps, using separate functions based on whether
a key appears only in the first map, only in the second map,
or appears in both maps.