Module DA.TextMap¶
TextMap - A map is an associative array data type composed of a collection of key/value pairs such that, each possible key appears at most once in the collection.
Functions¶
- fromListWith
- : (a -> a -> a) -> [(Text, a)] -> TextMap a - Create a map from a list of key/value pairs with a combining function. Examples: - fromListWith (++) [("A", [1]), ("A", [2]), ("B", [2]), ("B", [1]), ("A", [3])] == fromList [("A", [1, 2, 3]), ("B", [2, 1])] fromListWith (++) [] == (empty : TextMap [Int]) 
- toList
- 
Convert the map to a list of key/value pairs where the keys are in ascending order. 
- filter
- : (v -> Bool) -> TextMap v -> TextMap v - Filter the - TextMapusing a predicate: keep only the entries where the value satisfies the predicate.
- filterWithKey
- : (Text -> v -> Bool) -> TextMap v -> TextMap v - Filter the - TextMapusing a predicate: keep only the entries which satisfy the predicate.
- delete
- : Text -> TextMap a -> TextMap a - Delete a key and its value from the map. When the key is not a member of the map, the original map is returned. 
- insert
- : Text -> a -> TextMap a -> TextMap a - Insert 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. 
- union
- : TextMap a -> TextMap a -> TextMap a - The union of two maps, preferring the first map when equal keys are encountered. 
- merge
- : (Text -> a -> Optional c) -> (Text -> b -> Optional c) -> (Text -> a -> b -> Optional c) -> TextMap a -> TextMap b -> TextMap c - Merge two maps. - merge f g h x yapplies- fto all key/value pairs whose key only appears in- x,- gto all pairs whose key only appears in- yand- hto all pairs whose key appears in both- xand- y. In the end, all pairs yielding- Someare collected as the result.