Module Data.TreeMap

An efficient implementation of persistent ordered maps from keys to values based on AVL trees.

Properties of ordered maps

An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is done to restore this property.

Lookup, insertion, and deletion all take O(log n) time in both the average and worst cases, where n is the number of nodes in the tree prior to the operation. Insertions and deletions may require the tree to be rebalanced by one or more tree rotations.

AVL trees are height-balanced, but not weight-balanced nor μ-balanced, that is, sibling nodes can have hugely differing numbers of descendants.

Properties of this implementation

Keys will always be strict, whereas values can remain un-evaluated until two values will have to be combined.

Combination of two values takes place when a mapping for an already existing key is inserted in a map. In order to prevent building up of thunks that could lead to stack overflows later, the function combining the values will be evaluated right away, and this may trigger evaluation of one or both values in turn.

The default function used by operations like insert or union is const; and this will cause evaluation of the new value. Take a look at the following example:

 insert 7 undefined (insert 7 25 empty)            -- will fail
 insert 7 42 (insert 7 undefined empty)            -- will succeed
 insertWith (+) 7 42 (insert 7 undefined empty)    -- will fail

The last expression will fail because (Num.+) needs to evaluate both arguments. OTOH, expressions like

 fold (\t\v -> insertWith (+) 42 v t) empty [1..1_000_000]

will not cause stack overflow when later the value associated with 42 is actually used, nor will it need heap memory for one million thunks.

Operations

Creating Maps

Get an empty map with Monoid.mempty or ListEmpty.empty, make a singleton one with singleton or turn an association list into a TreeMap with fromList. The more general function fromListWith allows custom handling of associations with duplicate keys.

Add, Change or Remove Associations

Use insert, delete, adjust and replace. The more general form of insert is insertWith which accepts a function to combine the given value with an already existing one.

Lookups

The basic function is lookup, of which member and lookupDefault are variants. The operator (!!) may be used when the existence of the keys looked for is out of the question.

Because a tree map is ordered, we can find the associations with the smallest and largest keys in logarithmic time. See findMin and findMax.

Set operations

There is union, difference and intersection. More general functions unionWith and intersectionWith allow combination of the affected values.

Folds

Left folds as well as right folds are provided by foldValues and foldrValues. Variants foldWithKey and foldrWithKey allow examination not only of the value, but also of the key and they walk the tree in key order.

Frequently needed functions such as values, keys, each and size are just predefined folds for your convenience.

Filtering

Create a subset of an existing map with filterValues or filterWithKey.

Transformations

mapValues, mapWithKey and traverseWithKey should cover any need to transform an existing map.

Naming Conventions

Functions whose name have the With suffix take a custom function to combine two values and are thus more general than the ones without that suffix. Most often it is the case that

 xxx = xxxWith const

Functions whose name have the Values suffix operate on the values of the mappings contained in the map and take an appropriate custom function as argument. The Values suffix also serves to avoid conflicts with Prelude functions (i.e. map, filter, fold, foldr).

The companions of the Values functions have the suffix WithKey and accept functions that take an extra argument for the key. The key portion of a mapping or association is always passed first, followed by the associated value.

Imports

Table of Content

Definitions

singletonOrd k ⇒ k → v → TreeMap k v

O(1) Create a singleton map

sizeTreeMap k vInt

O(n) Compute the size of the map

insertOrd 𝖆 ⇒ 𝖆 → 𝖇 → TreeMap 𝖆 𝖇TreeMap 𝖆 𝖇

O(log n)

 insert k v map

returns a TreeMap where k is associated with v such that

 lookup k (insert k v map) = Just v

If k was already associated with some value in map, then v will get evaluated to WHNF, otherwise it is left alone.

insertWithOrd 𝖆 ⇒ (𝖇→𝖇→𝖇) → 𝖆 → 𝖇 → TreeMap 𝖆 𝖇TreeMap 𝖆 𝖇

O(log n)

 insertWith f k v m

If m does not contain k, this works like insert. Otherwise, the existing association of k with some value v' is replaced by an association of k with the result of evaluating

 f v v'

in the resulting map.

Strict evaluation is necessary to prevent building up of large thunks of the form

 f v3 (f v2 (f v1 v0))

Note that

 insert = insertWith const

and that this will evaluate the new value in case of an update. If you want to prevent this, use

 replace k v = insert k v . delete k

The replaced value will be evaluated only if the given function is strict in the second argument. Since const is lazy in the second argument, the following will be fine:

 insert "foo" 7 (insert "foo" undefined (delete "foo" m))

That is, the value that is inserted for a given key first is not evaluated on insertion, and only evaluated on update if the update function demands it, which is not the case for a plain insert.

deleteOrd k ⇒ k → TreeMap k vTreeMap k v

O(log n)

 delete k tm

is a HashMap m such that

 lookup k m = Nothing

and for any other key o

 lookup o m = lookup o tm

Less formally, the association of k with some value, if any, is removed in the result, while all other associations are retained.

If tm didn't contain k in the first place,

 delete k tm = tm
lookupOrd k ⇒ k → TreeMap k vMaybe v

O(log n)

 lookup k m

If k is associated with some value v in map m, it returns

 Just v

and otherwise

 Nothing
findMinTreeMap k vMaybe (k, v)

O(log n)

Find the minimum element in the tree. For empty trees, this is Maybe.Nothing.

findMaxTreeMap k vMaybe (k, v)

O(log n)

Find the maximum element in the tree. For empty trees, this is Maybe.Nothing.

memberOrd a ⇒ a → TreeMap a bBool

O(log n)

Checks whether the key is present in the map

lookupDefaultOrd b ⇒ a → b → TreeMap b a → a

O(log n)

Return the value to which the specified key is mapped, or the default value if this map contains no mapping for the key.

!!Ord k ⇒ TreeMap k v → k → v

O(log n)

Return the value associated with the given key in the map. Fails with error if the key is not present.

adjustOrd k ⇒ (v → v) → k → TreeMap k vTreeMap k v

O(log n)

Adjust the value tied to a given key in this map only if it is present. Otherwise, leave the map alone.

replaceOrd k ⇒ k → v → TreeMap k vTreeMap k v

O(log n)

 replace k v m = insert k v . delete k $ m

Insert or update the association of k with v in m but avoid evaluation of v even if m already contains k.

See also notes concerning updates on function insertWith.

unionWithOrd k ⇒ (v → v → v) → TreeMap k vTreeMap k vTreeMap k v

O(m*log n)

 unionWith f left right

Computes the union of two hash maps by inserting the elements of the left map into the right map.

If a key occurs in both maps, the function f provided in the first argument will be applied to the value from the left map and the right map like so:

 f leftval rightval

to compute the result that goes into the resulting map.

This works in the same way as insertWith, that is, the value from the left hash map will be evaluated while the value from the right map may be evaluated only if the function demands it. However, values associated with keys that are member of only one map are left alone.

unionOrd k ⇒ TreeMap k vTreeMap k vTreeMap k v

O(m*log n)

Computes the union of two hash maps.

If a key occurs in both maps, the value from the left map will be evaluated and taken over to the new map.

Because

 union  =  unionWith const

the considerations concerning strictness apply for union in the same way as for unionWith.

unionsOrd k ⇒ [TreeMap k v]TreeMap k v

The union of all TreeMaps in a list.

foldValues ∷ (a → v → a) → aTreeMap k v → a

O(n)

 foldValues f a map

applies the operation f to the values in the map in no particular order.

foldWithKey ∷ (a → c → b → a) → aTreeMap c b → a

O(n)

 foldWithKey f a map

applies the operation f to the keys and values in the map using the left identity a as starting value from the left in ascending key order.

 f (f (f a k0 v0) k1 v1) kn vn
foldrValues ∷ (v → a → a) → aTreeMap k v → a

O(n)

 foldrValues f a map

applies the operation f to the values in the map in no particular order.

foldrWithKey ∷ (c → b → a → a) → aTreeMap c b → a

O(n)

 foldrWithKey f a map

applies the operation f to the keys and values in the map using the right identity a as starting value from the right in descending key order:

 f k0 v0 (f k1 v1 (f kn vn a))
mapValues ∷ (v → u) → TreeMap k vTreeMap k u

O(n)

Transform a map by applying a function to every value.

mapWithKey ∷ (k → v → u) → TreeMap k vTreeMap k u

O(n)

Transform a map by applying a function to every key and its associated value.

traverseWithKeyApplicative a ⇒ (k → v → a u) → TreeMap k v → a (TreeMap k u)

O(n)

Transform a map by applying an applicative functor to every key and its associated value.

filterWithKeyOrd k ⇒ (k → v → Bool) → TreeMap k vTreeMap k v

O(n)

Filter a map, retaining only mappings whose key and value satisfy a given predicate.

filterValuesOrd k ⇒ (v → Bool) → TreeMap k vTreeMap k v

O(n)

Filter a map, retaining only mappings whose value satisfies a given predicate.

differenceOrd k ⇒ TreeMap k vTreeMap k uTreeMap k v

O(n*log m)

Computes the difference of two maps.

Returns a map that contains the mappings of the first map whose keys do not exist in the second.

intersectionOrd k ⇒ TreeMap k vTreeMap k uTreeMap k v

O(n*log m)

Computes the intersection of two maps.

Return a map that contains the mappings of the first map for keys that also exist in the second.

intersectionWithOrd k ⇒ (v → u → w) → TreeMap k vTreeMap k uTreeMap k w

O(n*log m)

Computes the intersection of two maps, combining the values with a given function.

fromListOrd a ⇒ [(a, b)]TreeMap a b

O(n)

Build a map from an association list. If the list contains duplicate mappings, the later mappings take precedence.

fromListWithOrd k ⇒ (v → v → v) → [(k, v)]TreeMap k v

O(n)

Build a map from an association list. Uses the provided function to merge values associated with duplicate keys.

valuesTreeMap a b → [b]

produces a list of the values in the map, in no particular order.

eachTreeMap a b → [(a, b)]

produces the key/value pairs of a map sorted by key

keysTreeMap a b → [a]

produces the keys of the map in ascending order

data TreeMap k v

Constructors

protected Leaf {key ∷ k, value ∷ v}

short for Node 1 Nil Nil k v

protected Nil

the empty tree

protected Node {höhe ∷ Int, left ∷ TreeMap k v, right ∷ TreeMap k v, key ∷ k, value ∷ v}

Member Functions

balanceTreeMap 𝖆 𝖇Int
deleteOrd 𝖇 ⇒ TreeMap 𝖇 𝖆 → 𝖇 → TreeMap 𝖇 𝖆

O(log n)

 tm.delete k

Variant of delete that is better suited for left folds and supports dot-notation

drotlrTreeMap 𝖇 𝖆TreeMap 𝖇 𝖆
drotrlTreeMap 𝖇 𝖆TreeMap 𝖇 𝖆
filterKVOrd k ⇒ (k → v → Bool) → TreeMap k vTreeMap k v
foldLOrdering → (c → a → b → c) → cTreeMap a b → c
 foldL o f a map

Fold a tree by applying an operation to an accumulator and key and value of every node, whereby the nodes are visited in a certain order specified by the first argument. Let the tree be

                       root
                     /     \
                    /       \
                   left    right

then the result is:

  • Eq the operation is first applied to the root node, and the result is passed to the left subtree, and the result of that is passed to the fold of the right subtree. Also known as "preorder" traversal.
  • Lt the operation is applied to the result of the fold done with the left sub-tree and the root node, and the result of that is passed to the fold of the right subtree. Also known as "inorder" traversal. This causes the operation to get applied to the key/value pairs in ascending key order.
  • Gt like with Lt, but the subtrees are processed in reverse order, which results in application of the operation to the key/value pairs in descending order.
foldROrdering → (a → b → c → c) → cTreeMap a b → c

foldR o f a map

Like TreeMap.foldL, but the function is right associative.

The following yields the key of map in ascending order:

 foldR Gt (\k\v\a → k:a) [] map   
heightTreeMap 𝖆 𝖇Int
höheTreeMap 𝖆 𝖇Int

access field höhe

indexOrd 𝖇 ⇒ TreeMap 𝖇 𝖆 → 𝖇 → 𝖆
insertOrd a ⇒ TreeMap a ba → b → TreeMap a b

O(log n)

 tm.insert k v

Variant of insert that is better suited for left folds and supports dot-notation.

insertITreeMap Int valueInt → value → TreeMap Int value

version of insert that is optimized for Int keys

insertListOrd a ⇒ TreeMap a b[(a, b)]TreeMap a b
insertSTreeMap String valueString → value → TreeMap String value
insertWorkOrd 𝖆 ⇒ (𝖇→𝖇→𝖇) → TreeMap 𝖆 𝖇𝖆 → 𝖇 → TreeMap 𝖆 𝖇

do the dirty work for insert operations

insertkvIInt → 𝖆 → TreeMap Int 𝖆TreeMap Int 𝖆
insertkvSString → 𝖆 → TreeMap String 𝖆TreeMap String 𝖆
keyTreeMap 𝖆 𝖇 → 𝖆

access field key

leftTreeMap 𝖆 𝖇TreeMap 𝖆 𝖇

access field left

leftmostTreeMap 𝖇 𝖆TreeMap 𝖇 𝖆
lookupOrd 𝖆 ⇒ TreeMap 𝖆 𝖇 → 𝖆 → Maybe 𝖇
lookupITreeMap Int valueIntMaybe value

version of lookup that is optimised for Int keys

lookupSTreeMap String valueStringMaybe value

version of lookup that is optimised for String keys

mapKV ∷ (𝖆→𝖇→𝖈) → TreeMap 𝖆 𝖇TreeMap 𝖆 𝖈
mapV ∷ (𝖆→𝖈) → TreeMap 𝖇 𝖆TreeMap 𝖇 𝖈
rebalanceTreeMap 𝖇 𝖆TreeMap 𝖇 𝖆
rightTreeMap 𝖆 𝖇TreeMap 𝖆 𝖇

access field right

rightmostTreeMap 𝖇 𝖆TreeMap 𝖇 𝖆
rotleftTreeMap 𝖇 𝖆TreeMap 𝖇 𝖆
rotrightTreeMap 𝖇 𝖆TreeMap 𝖇 𝖆
traverseKVApplicative 𝖆 ⇒ (𝖈→𝖉→𝖆 𝖇) → TreeMap 𝖈 𝖉 → 𝖆 (TreeMap 𝖈 𝖇)
updatekvIInt → 𝖆 → TreeMap Int 𝖆TreeMap Int 𝖆
updatekvSString → 𝖆 → TreeMap String 𝖆TreeMap String 𝖆
valueTreeMap 𝖇 𝖆 → 𝖆

access field value

type TreeSet a = TreeMap a ()
includingOrd 𝖆 ⇒ TreeSet 𝖆𝖆TreeSet 𝖆
containsOrd 𝖇 ⇒ TreeMap 𝖇 𝖆 → 𝖇 → Bool
fromKeysOrd 𝖆 ⇒ [𝖆]TreeSet 𝖆

Instances

instance ArrayElement (TreeMap a b)

TreeMap can be used as array element

Member Functions

arrayFromIndexList[(Int, TreeMap 𝖇 𝖆)]JArray (TreeMap 𝖇 𝖆)

inherited from ArrayElement.arrayFromIndexList

arrayFromIndexListST[(Int, TreeMap 𝖇 𝖆)]STMutable 𝖈 (JArray (TreeMap 𝖇 𝖆))

inherited from ArrayElement.arrayFromIndexListST

arrayFromList[TreeMap 𝖇 𝖆]JArray (TreeMap 𝖇 𝖆)

inherited from ArrayElement.arrayFromList

arrayFromListST[TreeMap 𝖇 𝖆]STMutable 𝖈 (JArray (TreeMap 𝖇 𝖆))

inherited from ArrayElement.arrayFromListST

arrayFromMaybeList[Maybe (TreeMap 𝖇 𝖆)]JArray (TreeMap 𝖇 𝖆)

inherited from ArrayElement.arrayFromMaybeList

arrayFromMaybeListST[Maybe (TreeMap 𝖇 𝖆)]STMutable 𝖈 (JArray (TreeMap 𝖇 𝖆))

inherited from ArrayElement.arrayFromMaybeListST

arrayLengthJArray (TreeMap 𝖇 𝖆)Int
pure native .length

inherited from ArrayElement.arrayLength

elemAtJArray (TreeMap 𝖇 𝖆)IntTreeMap 𝖇 𝖆
pure native [i]

inherited from ArrayElement.elemAt

getAtArrayOf 𝖈 (TreeMap 𝖇 𝖆)IntST 𝖈 (Maybe (TreeMap 𝖇 𝖆))
native [i]

inherited from ArrayElement.getAt

getElemAtArrayOf 𝖈 (TreeMap 𝖇 𝖆)IntST 𝖈 (TreeMap 𝖇 𝖆)
native [i]

inherited from ArrayElement.getElemAt

itemAtJArray (TreeMap 𝖇 𝖆)IntMaybe (TreeMap 𝖇 𝖆)
pure native [i]

inherited from ArrayElement.itemAt

javaClassClass (TreeMap 𝖇 𝖆)
pure native TTreeMap.class
listFromArrayJArray (TreeMap 𝖇 𝖆) → [TreeMap 𝖇 𝖆]

inherited from ArrayElement.listFromArray

maybeListFromArrayJArray (TreeMap 𝖇 𝖆) → [Maybe (TreeMap 𝖇 𝖆)]

inherited from ArrayElement.maybeListFromArray

modifyAt ∷ (TreeMap 𝖇 𝖆 → TreeMap 𝖇 𝖆) → ArrayOf 𝖈 (TreeMap 𝖇 𝖆)IntST 𝖈 ()

inherited from ArrayElement.modifyAt

modifyElemAt ∷ (TreeMap 𝖇 𝖆 → TreeMap 𝖇 𝖆) → ArrayOf 𝖈 (TreeMap 𝖇 𝖆)IntST 𝖈 ()

inherited from ArrayElement.modifyElemAt

newArrayIntSTMutable 𝖈 (JArray (TreeMap 𝖇 𝖆))
native new[]

inherited from ArrayElement.newArray

setAtArrayOf 𝖈 (TreeMap 𝖇 𝖆)IntMaybe (TreeMap 𝖇 𝖆)ST 𝖈 ()
native []=

inherited from ArrayElement.setAt

setElemAtArrayOf 𝖈 (TreeMap 𝖇 𝖆)IntTreeMap 𝖇 𝖆ST 𝖈 ()
native []=

inherited from ArrayElement.setElemAt

instance Functor (TreeMap a)

Member Functions

fmap ∷ (𝖇 → 𝖈) → TreeMap 𝖆 𝖇TreeMap 𝖆 𝖈
infixl  4
instance ListEmpty (TreeMap a)

Member Functions

emptyTreeMap 𝖆 𝖇
nullTreeMap 𝖆 𝖇Bool
instance Ord a ⇒ Monoid (TreeMap a b)

Member Functions

mappendOrd 𝖇 ⇒ TreeMap 𝖇 𝖆TreeMap 𝖇 𝖆TreeMap 𝖇 𝖆
infixr  13
mconcatOrd 𝖇 ⇒ [TreeMap 𝖇 𝖆]TreeMap 𝖇 𝖆

inherited from Monoid.mconcat

memptyOrd 𝖇 ⇒ TreeMap 𝖇 𝖆
mtimesOrd 𝖇 ⇒ IntTreeMap 𝖇 𝖆 → TreeMap 𝖇 𝖆

inherited from Monoid.mtimes

sconcatOrd 𝖇 ⇒ [TreeMap 𝖇 𝖆]TreeMap 𝖇 𝖆

inherited from Semigroup.sconcat

stimesOrd 𝖇 ⇒ IntTreeMap 𝖇 𝖆 → TreeMap 𝖇 𝖆

inherited from Semigroup.stimes

instance (Show k, Show v) ⇒ Show (TreeMap k v)

Member Functions

display ∷ (Show 𝖇, Show 𝖆) ⇒ TreeMap 𝖇 𝖆String

inherited from Show.display

show ∷ (Show 𝖇, Show 𝖆) ⇒ TreeMap 𝖇 𝖆String

Function generated for derived instance.

showChars ∷ (Show 𝖇, Show 𝖆) ⇒ TreeMap 𝖇 𝖆 → [Char]

inherited from Show.showChars

showList ∷ (Show 𝖇, Show 𝖆) ⇒ [TreeMap 𝖇 𝖆]StringString

inherited from Show.showList

showsPrec ∷ (Show 𝖇, Show 𝖆) ⇒ IntTreeMap 𝖇 𝖆StringString

inherited from Show.showsPrec

showsub ∷ (Show 𝖇, Show 𝖆) ⇒ TreeMap 𝖇 𝖆String

Function generated for derived instance.

instance Traversable (TreeMap k)

Member Functions

foldMonoid 𝖇 ⇒ TreeMap 𝖆 𝖇 → 𝖇

inherited from Foldable.Foldable.fold

fold1Semigroup 𝖇 ⇒ TreeMap 𝖆 𝖇 → 𝖇

inherited from Foldable.Foldable.fold1

foldMapMonoid 𝖈 ⇒ (𝖇 → 𝖈) → TreeMap 𝖆 𝖇 → 𝖈

inherited from Foldable.Foldable.foldMap

foldMap1Semigroup 𝖈 ⇒ (𝖇 → 𝖈) → TreeMap 𝖆 𝖇 → 𝖈

inherited from Foldable.Foldable.foldMap1

foldl ∷ (𝖇 → 𝖈 → 𝖇) → 𝖇TreeMap 𝖆 𝖈 → 𝖇
foldl1 ∷ (𝖇 → 𝖇 → 𝖇) → TreeMap 𝖆 𝖇 → 𝖇

inherited from Foldable.Foldable.foldl1

foldr ∷ (𝖇 → 𝖈 → 𝖈) → 𝖈TreeMap 𝖆 𝖇 → 𝖈
foldr1 ∷ (𝖇 → 𝖇 → 𝖇) → TreeMap 𝖆 𝖇 → 𝖇

inherited from Foldable.Foldable.foldr1

mapMMonad 𝖉 ⇒ (𝖇 → 𝖉 𝖈) → TreeMap 𝖆 𝖇 → 𝖉 (TreeMap 𝖆 𝖈)

inherited from Traversable.mapM

sequenceMonad 𝖈 ⇒ TreeMap 𝖆 (𝖈 𝖇) → 𝖈 (TreeMap 𝖆 𝖇)

inherited from Traversable.sequence

sequenceAApplicative 𝖈 ⇒ TreeMap 𝖆 (𝖈 𝖇) → 𝖈 (TreeMap 𝖆 𝖇)

inherited from Traversable.sequenceA

traverseApplicative 𝖉 ⇒ (𝖇 → 𝖉 𝖈) → TreeMap 𝖆 𝖇 → 𝖉 (TreeMap 𝖆 𝖈)

O(n)

Transform a map by applying a function to every value.

Functions and Values by Type

TreeMap String value → String → value → TreeMap String value

TreeMap.insertS

TreeMap String value → StringMaybe value

TreeMap.lookupS

TreeMap Int value → Int → value → TreeMap Int value

TreeMap.insertI

TreeMap Int value → IntMaybe value

TreeMap.lookupI

String → 𝖆 → TreeMap String 𝖆 → TreeMap String 𝖆

TreeMap.updatekvS, TreeMap.insertkvS

Int → 𝖆 → TreeMap Int 𝖆 → TreeMap Int 𝖆

TreeMap.updatekvI, TreeMap.insertkvI

Ord 𝖆 ⇒ TreeSet 𝖆 → 𝖆 → TreeSet 𝖆

including

Ord 𝖆 ⇒ [𝖆] → TreeSet 𝖆

fromKeys

(𝖇 → 𝖇 → 𝖇) → TreeMap 𝖆 𝖇 → 𝖇

Traversable_TreeMap.foldl1, Traversable_TreeMap.foldr1

TreeMap a b → [(a, b)]

each

TreeMap a b → [a]

keys

TreeMap a b → [b]

values

TreeMap k v → Maybe (k, v)

findMax, findMin

TreeMap k v → Int

size

TreeMap 𝖆 𝖇 → TreeMap 𝖆 𝖇 → TreeMap 𝖆 𝖇

TreeMap.upd$left, TreeMap.upd$right

TreeMap 𝖆 𝖇 → (TreeMap 𝖆 𝖇→TreeMap 𝖆 𝖇) → TreeMap 𝖆 𝖇

TreeMap.chg$right, TreeMap.chg$left

TreeMap 𝖆 𝖇 → (IntInt) → TreeMap 𝖆 𝖇

TreeMap.chg$höhe

TreeMap 𝖆 𝖇 → (𝖆→𝖆) → TreeMap 𝖆 𝖇

TreeMap.chg$key

TreeMap 𝖆 𝖇 → (𝖇→𝖇) → TreeMap 𝖆 𝖇

TreeMap.chg$value

TreeMap 𝖆 𝖇 → IntTreeMap 𝖆 𝖇

TreeMap.upd$höhe

TreeMap 𝖆 𝖇 → 𝖆 → TreeMap 𝖆 𝖇

TreeMap.upd$key

TreeMap 𝖆 𝖇 → 𝖇 → TreeMap 𝖆 𝖇

TreeMap.upd$value

TreeMap 𝖆 𝖇 → TreeMap 𝖆 𝖇

TreeMap.right, TreeMap.left

TreeMap 𝖆 𝖇 → Bool

ListEmpty_TreeMap.null, TreeMap.has$right, TreeMap.has$key, TreeMap.has$left, TreeMap.has$value, TreeMap.has$höhe

TreeMap 𝖆 𝖇 → Int

TreeMap.height, TreeMap.höhe, TreeMap.balance

TreeMap 𝖆 𝖇 → 𝖆

TreeMap.key

TreeMap 𝖇 𝖆 → TreeMap 𝖇 𝖆

TreeMap.rotleft, TreeMap.rotright, TreeMap.rebalance, TreeMap.leftmost, TreeMap.rightmost, TreeMap.drotlr, TreeMap.drotrl

TreeMap 𝖇 𝖆 → 𝖆

TreeMap.value

JArray (TreeMap 𝖇 𝖆) → IntTreeMap 𝖇 𝖆

ArrayElement_TreeMap.elemAt

JArray (TreeMap 𝖇 𝖆) → IntMaybe (TreeMap 𝖇 𝖆)

ArrayElement_TreeMap.itemAt

JArray (TreeMap 𝖇 𝖆) → [TreeMap 𝖇 𝖆]

ArrayElement_TreeMap.listFromArray

JArray (TreeMap 𝖇 𝖆) → [Maybe (TreeMap 𝖇 𝖆)]

ArrayElement_TreeMap.maybeListFromArray

JArray (TreeMap 𝖇 𝖆) → Int

ArrayElement_TreeMap.arrayLength

[TreeMap 𝖇 𝖆] → JArray (TreeMap 𝖇 𝖆)

ArrayElement_TreeMap.arrayFromList

[(Int, TreeMap 𝖇 𝖆)] → JArray (TreeMap 𝖇 𝖆)

ArrayElement_TreeMap.arrayFromIndexList

[Maybe (TreeMap 𝖇 𝖆)] → JArray (TreeMap 𝖇 𝖆)

ArrayElement_TreeMap.arrayFromMaybeList

IntTreeMap k v → TreeMap k v → k → v → TreeMap k v

TreeMap.Node

k → v → TreeMap k v

TreeMap.Leaf

Monoid 𝖇 ⇒ TreeMap 𝖆 𝖇 → 𝖇

Traversable_TreeMap.fold

Semigroup 𝖇 ⇒ TreeMap 𝖆 𝖇 → 𝖇

Traversable_TreeMap.fold1

Ord a ⇒ TreeMap a b → [(a, b)] → TreeMap a b

TreeMap.insertList

Ord a ⇒ TreeMap a b → a → b → TreeMap a b

TreeMap.insert

Ord a ⇒ [(a, b)] → TreeMap a b

fromList

Ord a ⇒ a → TreeMap a b → Bool

member

Ord b ⇒ a → b → TreeMap b a → a

lookupDefault

Ord k ⇒ (k → v → Bool) → TreeMap k v → TreeMap k v

filterWithKey, TreeMap.filterKV

Ord k ⇒ (v → v → v) → TreeMap k v → TreeMap k v → TreeMap k v

unionWith

Ord k ⇒ (v → v → v) → [(k, v)] → TreeMap k v

fromListWith

Ord k ⇒ (v → Bool) → TreeMap k v → TreeMap k v

filterValues

Ord k ⇒ (v → v) → k → TreeMap k v → TreeMap k v

adjust

Ord k ⇒ TreeMap k v → TreeMap k v → TreeMap k v

union

Ord k ⇒ TreeMap k v → k → v

!!

Ord k ⇒ [TreeMap k v] → TreeMap k v

unions

Ord k ⇒ k → TreeMap k v → TreeMap k v

delete

Ord k ⇒ k → TreeMap k v → Maybe v

lookup

Ord k ⇒ k → v → TreeMap k v → TreeMap k v

replace

Ord k ⇒ k → v → TreeMap k v

singleton

Ord 𝖆 ⇒ TreeMap 𝖆 𝖇 → 𝖆 → Maybe 𝖇

TreeMap.lookup

Ord 𝖆 ⇒ (𝖇→𝖇→𝖇) → TreeMap 𝖆 𝖇 → 𝖆 → 𝖇 → TreeMap 𝖆 𝖇

TreeMap.insertWork

Ord 𝖆 ⇒ (𝖇→𝖇→𝖇) → 𝖆 → 𝖇 → TreeMap 𝖆 𝖇 → TreeMap 𝖆 𝖇

insertWith

Ord 𝖆 ⇒ 𝖆 → 𝖇 → TreeMap 𝖆 𝖇 → TreeMap 𝖆 𝖇

insert

Ord 𝖇 ⇒ TreeMap 𝖇 𝖆 → TreeMap 𝖇 𝖆 → TreeMap 𝖇 𝖆

Monoid_TreeMap.mappend

Ord 𝖇 ⇒ TreeMap 𝖇 𝖆 → 𝖇 → TreeMap 𝖇 𝖆

TreeMap.delete

Ord 𝖇 ⇒ TreeMap 𝖇 𝖆 → 𝖇 → Bool

contains

Ord 𝖇 ⇒ TreeMap 𝖇 𝖆 → 𝖇 → 𝖆

TreeMap.index

Ord 𝖇 ⇒ [TreeMap 𝖇 𝖆] → TreeMap 𝖇 𝖆

Monoid_TreeMap.sconcat, Monoid_TreeMap.mconcat

Ord 𝖇 ⇒ IntTreeMap 𝖇 𝖆 → TreeMap 𝖇 𝖆

Monoid_TreeMap.stimes, Monoid_TreeMap.mtimes

(Show 𝖇, Show 𝖆) ⇒ TreeMap 𝖇 𝖆 → String

Show_TreeMap.showsub, Show_TreeMap.display, Show_TreeMap.show

(Show 𝖇, Show 𝖆) ⇒ TreeMap 𝖇 𝖆 → [Char]

Show_TreeMap.showChars

(Show 𝖇, Show 𝖆) ⇒ [TreeMap 𝖇 𝖆] → StringString

Show_TreeMap.showList

(Show 𝖇, Show 𝖆) ⇒ IntTreeMap 𝖇 𝖆 → StringString

Show_TreeMap.showsPrec

TreeMap k v

TreeMap.Nil

TreeMap 𝖆 𝖇

ListEmpty_TreeMap.empty

Class (TreeMap 𝖇 𝖆)

ArrayElement_TreeMap.javaClass

Ord 𝖇 ⇒ TreeMap 𝖇 𝖆

Monoid_TreeMap.mempty

(TreeMap 𝖇 𝖆 → TreeMap 𝖇 𝖆) → ArrayOf 𝖈 (TreeMap 𝖇 𝖆) → IntST 𝖈 ()

ArrayElement_TreeMap.modifyAt, ArrayElement_TreeMap.modifyElemAt

(a → c → b → a) → a → TreeMap c b → a

foldWithKey

(a → v → a) → a → TreeMap k v → a

foldValues

(c → b → a → a) → a → TreeMap c b → a

foldrWithKey

(k → v → u) → TreeMap k v → TreeMap k u

mapWithKey

(v → a → a) → a → TreeMap k v → a

foldrValues

(v → u) → TreeMap k v → TreeMap k u

mapValues

(𝖇 → 𝖈 → 𝖇) → 𝖇 → TreeMap 𝖆 𝖈 → 𝖇

Traversable_TreeMap.foldl

(𝖇 → 𝖈 → 𝖈) → 𝖈 → TreeMap 𝖆 𝖇 → 𝖈

Traversable_TreeMap.foldr

(𝖇 → 𝖈) → TreeMap 𝖆 𝖇 → TreeMap 𝖆 𝖈

Functor_TreeMap.fmap

(𝖆→𝖇→𝖈) → TreeMap 𝖆 𝖇 → TreeMap 𝖆 𝖈

TreeMap.mapKV

(𝖆→𝖈) → TreeMap 𝖇 𝖆 → TreeMap 𝖇 𝖈

TreeMap.mapV

ArrayOf 𝖈 (TreeMap 𝖇 𝖆) → IntTreeMap 𝖇 𝖆 → ST 𝖈 ()

ArrayElement_TreeMap.setElemAt

ArrayOf 𝖈 (TreeMap 𝖇 𝖆) → IntMaybe (TreeMap 𝖇 𝖆) → ST 𝖈 ()

ArrayElement_TreeMap.setAt

ArrayOf 𝖈 (TreeMap 𝖇 𝖆) → IntST 𝖈 (TreeMap 𝖇 𝖆)

ArrayElement_TreeMap.getElemAt

ArrayOf 𝖈 (TreeMap 𝖇 𝖆) → IntST 𝖈 (Maybe (TreeMap 𝖇 𝖆))

ArrayElement_TreeMap.getAt

[TreeMap 𝖇 𝖆] → STMutable 𝖈 (JArray (TreeMap 𝖇 𝖆))

ArrayElement_TreeMap.arrayFromListST

[(Int, TreeMap 𝖇 𝖆)] → STMutable 𝖈 (JArray (TreeMap 𝖇 𝖆))

ArrayElement_TreeMap.arrayFromIndexListST

[Maybe (TreeMap 𝖇 𝖆)] → STMutable 𝖈 (JArray (TreeMap 𝖇 𝖆))

ArrayElement_TreeMap.arrayFromMaybeListST

IntSTMutable 𝖈 (JArray (TreeMap 𝖇 𝖆))

ArrayElement_TreeMap.newArray

Ordering → (a → b → c → c) → c → TreeMap a b → c

TreeMap.foldR

Ordering → (c → a → b → c) → c → TreeMap a b → c

TreeMap.foldL

Monoid 𝖈 ⇒ (𝖇 → 𝖈) → TreeMap 𝖆 𝖇 → 𝖈

Traversable_TreeMap.foldMap

Semigroup 𝖈 ⇒ (𝖇 → 𝖈) → TreeMap 𝖆 𝖇 → 𝖈

Traversable_TreeMap.foldMap1

Ord k ⇒ TreeMap k v → TreeMap k u → TreeMap k v

difference, intersection

Applicative 𝖈 ⇒ TreeMap 𝖆 (𝖈 𝖇) → 𝖈 (TreeMap 𝖆 𝖇)

Traversable_TreeMap.sequenceA

Monad 𝖈 ⇒ TreeMap 𝖆 (𝖈 𝖇) → 𝖈 (TreeMap 𝖆 𝖇)

Traversable_TreeMap.sequence

Ord k ⇒ (v → u → w) → TreeMap k v → TreeMap k u → TreeMap k w

intersectionWith

Applicative a ⇒ (k → v → a u) → TreeMap k v → a (TreeMap k u)

traverseWithKey

Applicative 𝖆 ⇒ (𝖈→𝖉→𝖆 𝖇) → TreeMap 𝖈 𝖉 → 𝖆 (TreeMap 𝖈 𝖇)

TreeMap.traverseKV

Applicative 𝖉 ⇒ (𝖇 → 𝖉 𝖈) → TreeMap 𝖆 𝖇 → 𝖉 (TreeMap 𝖆 𝖈)

Traversable_TreeMap.traverse

Monad 𝖉 ⇒ (𝖇 → 𝖉 𝖈) → TreeMap 𝖆 𝖇 → 𝖉 (TreeMap 𝖆 𝖈)

Traversable_TreeMap.mapM

Valid HTML 4.01 Strict