Safe Haskell | None |
---|---|
Language | Haskell2010 |
Non empty wrapper around the impure Tree
.
- data NonEmptyTree key val where
- NonEmptyTree :: {..} -> NonEmptyTree key val
- data Node height key val where
- fromTree :: Tree key val -> Maybe (NonEmptyTree key val)
- toTree :: NonEmptyTree key val -> Tree key val
- nonEmptyToList :: (AllocReaderM m, Key k, Value v) => NonEmptyTree k v -> m (NonEmpty (k, v))
- fromNonEmptyList :: (AllocM m, Key k, Value v) => NonEmpty (k, v) -> m (NonEmptyTree k v)
- insertNonEmptyTree :: (AllocM m, Key k, Value v) => k -> v -> NonEmptyTree k v -> m (NonEmptyTree k v)
- insertNonEmptyTreeMany :: (AllocM m, Key k, Value v) => Map k v -> NonEmptyTree k v -> m (NonEmptyTree k v)
Structures
data NonEmptyTree key val where Source #
A non-empty variant of Tree
.
NonEmptyTree :: {..} -> NonEmptyTree key val | |
|
data Node height key val where Source #
A node in a B+-tree.
Nodes are parameterized over the key and value types and are additionally indexed by their height. All paths from the root to the leaves have the same length. The height is the number of edges from the root to the leaves, i.e. leaves are at height zero and index nodes increase the height.
Sub-trees are represented by a NodeId
that are used to resolve the actual
storage location of the sub-tree node.
Conversions
fromTree :: Tree key val -> Maybe (NonEmptyTree key val) Source #
Convert a Tree
into a NonEmptyTree
.
toTree :: NonEmptyTree key val -> Tree key val Source #
Convert a NonEmptyTree
into a Tree
.
nonEmptyToList :: (AllocReaderM m, Key k, Value v) => NonEmptyTree k v -> m (NonEmpty (k, v)) Source #
Convert a non-empty tree to a list of key-value pairs.
Construction
fromNonEmptyList :: (AllocM m, Key k, Value v) => NonEmpty (k, v) -> m (NonEmptyTree k v) Source #
Create a NonEmptyTree
from a NonEmpty
list.
Inserting
insertNonEmptyTree :: (AllocM m, Key k, Value v) => k -> v -> NonEmptyTree k v -> m (NonEmptyTree k v) Source #
Insert an item into a NonEmptyTree
insertNonEmptyTreeMany :: (AllocM m, Key k, Value v) => Map k v -> NonEmptyTree k v -> m (NonEmptyTree k v) Source #
Bulk insert a bunch of key-value pairs into a NonEmptyTree
.