Skip to main content

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.

Module Snapshot

Lifecycle

Stable.

Notices

Status: active Introduced in: 3.4.9 Removed in: - Warnings: 0 Deprecations: 0 Deprecated since: -

Functions

fromList

Create a map from a list of key/value pairs.

fromListWithL

Create 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

Create a map from a list of key/value pairs like fromListWithL with the combining function flipped. Examples:

fromListWith

toList

Convert the map to a list of key/value pairs where the keys are in ascending order.

empty

The empty map.

size

Number of elements in the map.

null

Is the map empty?

lookup

Lookup the value at a key in the map.

member

Is the key a member of the map?

filter

Filter the TextMap using a predicate: keep only the entries where the value satisfies the predicate.

filterWithKey

Filter the TextMap using a predicate: keep only the entries which satisfy the predicate.

delete

Delete a key and its value from the map. When the key is not a member of the map, the original map is returned.

singleton

Create a singleton map.

insert

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.

insertWith

Insert 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

The union of two maps, preferring the first map when equal keys are encountered.

merge

Merge 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.

Orphan Typeclass Instances

  • instance Show a => Show (TextMap a)
  • instance Eq a => Eq (TextMap a)
  • instance Ord a => Ord (TextMap a)
  • instance Semigroup (TextMap b)
  • instance Monoid (TextMap b)
  • instance Functor TextMap
  • instance Foldable TextMap
  • instance Traversable TextMap