Safe Haskell | None |
---|---|
Language | Haskell2010 |
Implementation of prefix tree for TOML AST.
Synopsis
- newtype Piece = Piece {}
- newtype Key = Key {}
- type Prefix = Key
- pattern (:||) :: Piece -> [Piece] -> Key
- data KeysDiff
- keysDiff :: Key -> Key -> KeysDiff
- data PrefixTree a
- (<|) :: Piece -> Key -> Key
- singleT :: Key -> a -> PrefixTree a
- insertT :: Key -> a -> PrefixTree a -> PrefixTree a
- lookupT :: Key -> PrefixTree a -> Maybe a
- toListT :: PrefixTree a -> [(Key, 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)]
Core types
Represents the key piece of some layer.
Instances
Eq Piece Source # | |
Ord Piece Source # | |
Show Piece Source # | |
IsString Piece Source # | |
Defined in Toml.PrefixTree fromString :: String -> Piece # | |
Generic Piece Source # | |
NFData Piece Source # | |
Defined in Toml.PrefixTree | |
Hashable Piece Source # | |
Defined in Toml.PrefixTree | |
type Rep Piece Source # | |
Defined in Toml.PrefixTree |
Key of value in key = val
pair. Represents as non-empty list of key
components — Piece
s. Key like
site."google.com"
is represented like
Key (Piece "site" :| [Piece "\"google.com\""])
Instances
Eq Key Source # | |
Ord Key Source # | |
Show Key Source # | |
IsString Key Source # | Split a dot-separated string into This instance is not safe for now. Use carefully. If you try to use as a key
string like this |
Defined in Toml.PrefixTree fromString :: String -> Key # | |
Generic Key Source # | |
Semigroup Key Source # | |
NFData Key Source # | |
Defined in Toml.PrefixTree | |
Hashable Key Source # | |
Defined in Toml.PrefixTree | |
type Rep Key Source # | |
Defined in Toml.PrefixTree |
pattern (:||) :: Piece -> [Piece] -> Key Source #
Bidirectional pattern synonym for constructing and deconstructing Key
s.
Key difference
Data structure to compare keys.
Non-empty prefix tree
data PrefixTree a Source #
Data structure to represent table tree for toml
.
Instances
singleT :: Key -> a -> PrefixTree a Source #
Creates a PrefixTree
of one key-value element.
insertT :: Key -> a -> PrefixTree a -> PrefixTree a Source #
Inserts key-value element into the given PrefixTree
.
lookupT :: Key -> PrefixTree a -> Maybe a Source #
Looks up the value at a key in the PrefixTree
.
toListT :: PrefixTree a -> [(Key, a)] Source #
Converts PrefixTree
to the list of pairs.
Prefix map that stores roots of PrefixTree
type PrefixMap a = HashMap Piece (PrefixTree a) Source #
Map of layer names and corresponding PrefixTree
s.
insert :: Key -> a -> PrefixMap a -> PrefixMap a Source #
Inserts key-value element into the given PrefixMap
.