nspec - 0.1.1

Stdlib.Data.Map

Definitions

Constructors

| mkBinding@{ key : Key; value : Value; }

Constructors

| mkMap (AVLTree (Binding Key Value))

insert {Key Value : Type} {{Ord Key}} (key : Key) (elem : Value) (map : Map Key Value) : Map Key ValueSource#

𝒪(log 𝓃). Inserts a new `key` and `value` into `map`. If `key` is already present in `map`, the associated value is replaced with the supplied `value`.

lookup {Key Value} {{Ord Key}} (key : Key) (map : Map Key Value) : Maybe ValueSource#

𝒪(log 𝓃). Queries whether a given `key` is in `map`.

isMember {Key Value} {{Ord Key}} (key : Key) (map : Map Key Value) : BoolSource#

𝒪(log 𝓃). Queries whether a given `key` is in `map`.

isEmpty {Key Value} (map : Map Key Value) : BoolSource#

𝒪(1). Checks if a Map is empty.

size {Key Value} (map : Map Key Value) : NatSource#

𝒪(𝓃). Returns the number of elements of a Map.

delete {Key Value} {{Ord Key}} (key : Key) (map : Map Key Value) : Map Key ValueSource#

𝒪(log 𝓃). Removes `key` assignment from `map`.

intersection {Key Value} {{Ord Key}} (map1 map2 : Map Key Value) : Map Key ValueSource#

𝒪(n log n). Intersection of two maps. Returns data in the first map for the keys existing in both maps.

difference {Key Value} {{Ord Key}} (map1 map2 : Map Key Value) : Map Key ValueSource#

𝒪(n log n). Return elements of `map1` with keys not existing in `map2`.

unionLeft {Key Value} {{Ord Key}} (map1 map2 : Map Key Value) : Map Key ValueSource#

𝒪(n log n). Returns a Map containing the elements that are in `map1` or `map2`. This is a left-biased union of `map1` and `map2` which prefers `map1` when duplicate keys are encountered.

union {Key Value} {{Ord Key}} (map1 map2 : Map Key Value) : Map Key ValueSource#

𝒪(n log n). Returns a Map containing the elements that are in `map1` or `map2`.

disjointUnion {Key Value} {{Ord Key}} (map1 map2 : Map Key Value) : Result Key (Map Key Value)Source#

O(n log n). If `map1` and `map2` are disjoint (have no common keys), then returns `ok map` where `map` is the union of `map1` and `map2`. If `map1` and `map2` are not disjoint, then returns `error k` where `k` is a common key.

all {Key Value} (predicate : Key -> Value -> Bool) (map : Map Key Value) : BoolSource#

𝒪(𝓃). Returns true if all key-value pairs in `map` satisfy `predicate`.

any {Key Value} (predicate : Key -> Value -> Bool) (map : Map Key Value) : BoolSource#

𝒪(𝓃). Returns true if some key-value pair in `map` satisfies `predicate`.

filter {Key Value} {{Ord Key}} (predicate : Key -> Value -> Bool) (map : Map Key Value) : Map Key ValueSource#

𝒪(n log n). Returns a Map containing all key-value pairs of `map` that satisfy `predicate`.

instance eqMapI {A B} {{Eq A}} {{Eq B}} : Eq (Map A B)Source#

instance ordMapI {A B} {{Ord A}} {{Ord B}} : Ord (Map A B)Source#