tomland-1.3.3.1: Bidirectional TOML serialization
Copyright(c) 2018-2021 Kowainik
LicenseMPL-2.0
MaintainerKowainik <xrom.xkov@gmail.com>
StabilityStable
PortabilityPortable
Safe HaskellNone
LanguageHaskell2010

Toml.Type.PrefixTree

Description

Implementation of prefix tree for TOML AST.

Since: 0.0.0

Synopsis

Non-empty prefix tree

data PrefixTree a Source #

Data structure to represent table tree for toml.

Since: 0.0.0

Constructors

Leaf

End of a key.

Fields

  • !Key

    End piece of the key.

  • !a

    Value at the end.

Branch

Values along pieces of a key.

Fields

  • !Prefix

    Greatest common key prefix.

  • !(Maybe a)

    Possible value at that point.

  • !(PrefixMap a)

    Values at suffixes of the prefix.

Instances

Instances details
Eq a => Eq (PrefixTree a) Source # 
Instance details

Defined in Toml.Type.PrefixTree

Methods

(==) :: PrefixTree a -> PrefixTree a -> Bool #

(/=) :: PrefixTree a -> PrefixTree a -> Bool #

Show a => Show (PrefixTree a) Source # 
Instance details

Defined in Toml.Type.PrefixTree

Generic (PrefixTree a) Source # 
Instance details

Defined in Toml.Type.PrefixTree

Associated Types

type Rep (PrefixTree a) :: Type -> Type #

Methods

from :: PrefixTree a -> Rep (PrefixTree a) x #

to :: Rep (PrefixTree a) x -> PrefixTree a #

Semigroup (PrefixTree a) Source #

Since: 0.3

Instance details

Defined in Toml.Type.PrefixTree

NFData a => NFData (PrefixTree a) Source # 
Instance details

Defined in Toml.Type.PrefixTree

Methods

rnf :: PrefixTree a -> () #

type Rep (PrefixTree a) Source # 
Instance details

Defined in Toml.Type.PrefixTree

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 PrefixTrees. 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 PrefixTrees.

Since: 0.0.0

single :: Key -> a -> PrefixMap a Source #

Creates a PrefixMap of one key-value element.

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

fromList :: [(Key, a)] -> PrefixMap a Source #

Constructs PrefixMap structure from the given list of Key and value pairs.

Since: 0.0.0

toList :: PrefixMap a -> [(Key, a)] Source #

Converts PrefixMap to the list of pairs.

Since: 0.0.0

differenceWith :: (a -> b -> Maybe a) -> PrefixMap a -> PrefixMap b -> PrefixMap a Source #

Difference of two PrefixMaps. Returns elements of the first PrefixMap that are not existing in the second one.

Since: 1.3.2.0