Copyright | (c) 2018-2022 Kowainik |
---|---|
License | MPL-2.0 |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Stability | Stable |
Portability | Portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Implementation of prefix tree for TOML AST.
Since: 0.0.0
Synopsis
- data PrefixTree a
- singleT :: Key -> a -> PrefixTree a
- insertT :: Key -> a -> PrefixTree a -> PrefixTree a
- lookupT :: Key -> PrefixTree a -> Maybe a
- toListT :: PrefixTree a -> [(Key, a)]
- addPrefixT :: Prefix -> PrefixTree a -> PrefixTree a
- differenceWithT :: (a -> b -> Maybe a) -> PrefixTree a -> PrefixTree b -> Maybe (PrefixTree a)
- type PrefixMap a = HashMap Piece (PrefixTree a)
- single :: Key -> a -> PrefixMap a
- insert :: Key -> a -> PrefixMap a -> PrefixMap a
- lookup :: Key -> PrefixMap a -> Maybe a
- fromList :: [(Key, a)] -> PrefixMap a
- toList :: PrefixMap a -> [(Key, a)]
- differenceWith :: (a -> b -> Maybe a) -> PrefixMap a -> PrefixMap b -> PrefixMap a
Non-empty prefix tree
data PrefixTree a Source #
Data structure to represent table tree for toml
.
Since: 0.0.0
Instances
singleT :: Key -> a -> PrefixTree a Source #
Creates a PrefixTree
of one key-value element.
Since: 0.0.0
insertT :: Key -> a -> PrefixTree a -> PrefixTree a Source #
Inserts key-value element into the given PrefixTree
.
Since: 0.0.0
lookupT :: Key -> PrefixTree a -> Maybe a Source #
Looks up the value at a key in the PrefixTree
.
Since: 0.0.0
toListT :: PrefixTree a -> [(Key, a)] Source #
Converts PrefixTree
to the list of pairs.
Since: 0.0.0
addPrefixT :: Prefix -> PrefixTree a -> PrefixTree a Source #
Push Prefix
inside the given PrefixTree
.
Since: 1.3.2.0
differenceWithT :: (a -> b -> Maybe a) -> PrefixTree a -> PrefixTree b -> Maybe (PrefixTree a) Source #
Difference of two PrefixTree
s. Returns elements of the first PrefixTree
that are not existing in the second one.
Since: 1.3.2.0
Prefix map that stores roots of PrefixTree
type PrefixMap a = HashMap Piece (PrefixTree a) Source #
Map of layer names and corresponding PrefixTree
s.
Since: 0.0.0
insert :: Key -> a -> PrefixMap a -> PrefixMap a Source #
Inserts key-value element into the given PrefixMap
.
Since: 0.0.0
lookup :: Key -> PrefixMap a -> Maybe a Source #
Looks up the value at a key in the PrefixMap
.
Since: 0.0.0