Reference documentation for Daml module DA.TextMap.
Daml module
DA.TextMap
TextMap - A map is an associative array data type composed of a
Daml
ModuleDA.TextMap
Latest release3.7.5
Functions
fromList
fromList : [(Text, a)] -> TextMapaCreate a map from a list of key/value pairs.
fromListWithL
fromListWithL : (a -> a -> a) -> [(Text, a)] -> TextMapaCreate 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 : (a -> a -> a) -> [(Text, a)] -> TextMapaCreate a map from a list of key/value pairs like fromListWithL
with the combining function flipped. Examples:
member : Text -> TextMapv -> BoolIs the key a member of the map?
filter
filter : (v -> Bool) -> TextMapv -> TextMapvFilter the TextMap using a predicate: keep only the entries where the
value satisfies the predicate.
filterWithKey
filterWithKey : (Text -> v -> Bool) -> TextMapv -> TextMapvFilter the TextMap using a predicate: keep only the entries which
satisfy the predicate.
delete
delete : Text -> TextMapa -> TextMapaDelete a key and its value from the map. When the key is not a
member of the map, the original map is returned.
singleton
singleton : Text -> a -> TextMapaCreate a singleton map.
insert
insert : Text -> a -> TextMapa -> TextMapaInsert 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
insertWith : (v -> v -> v) -> Text -> v -> TextMapv -> TextMapvInsert 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.
union
union : TextMapa -> TextMapa -> TextMapaThe union of two maps, preferring the first map when equal
keys are encountered.
merge
merge : (Text -> a -> Optionalc) -> (Text -> b -> Optionalc) -> (Text -> a -> b -> Optionalc) -> TextMapa -> TextMapb -> TextMapcMerge two maps. merge f g h x y applies f to all key/value pairs
whose key only appears in x, g to all pairs whose key only appears
in y and h to all pairs whose key appears in both x and y.
In the end, all pairs yielding Some are collected as the result.