pseudo-trie-0.0.4.3: A tagged rose-tree with short circuited unique leaves

Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Trie.Pseudo

Synopsis

Documentation

data PseudoTrie t a Source

Non-Empty Rose Tree with explicit emptyness

Constructors

More !(t, Maybe a) !(NonEmpty (PseudoTrie t a)) 
Rest !(NonEmpty t) a 
Nil 

Instances

Functor (PseudoTrie t) 
Foldable (PseudoTrie t)

Depth first

(Eq t, Eq a) => Eq (PseudoTrie t a) 
(Show t, Show a) => Show (PseudoTrie t a) 
Eq t => Monoid (PseudoTrie t a)

Overwriting instance

beginsWith :: Eq t => PseudoTrie t a -> t -> Bool Source

assign :: Eq t => NonEmpty t -> Maybe a -> PseudoTrie t a -> PseudoTrie t a Source

Provides a form of deletion by setting a path to Nothing, but doesn't cleanup like prune

merge :: Eq t => PseudoTrie t a -> PseudoTrie t a -> PseudoTrie t a Source

Overwrite the LHS point-wise with the RHS's contents

add :: Eq t => NonEmpty t -> PseudoTrie t a -> PseudoTrie t a -> PseudoTrie t a Source

toAssocs :: PseudoTrie t a -> [(NonEmpty t, a)] Source

fromAssocs :: Eq t => [(NonEmpty t, a)] -> PseudoTrie t a Source

lookup :: Eq t => NonEmpty t -> PseudoTrie t a -> Maybe a Source

lookupNearestParent :: Eq t => [t] -> PseudoTrie t a -> Maybe a Source

areDisjoint :: Eq t => PseudoTrie t a -> PseudoTrie t a -> Bool Source

Simple test on the heads of two tries

intersectionWith :: Eq t => (a -> b -> c) -> PseudoTrie t a -> PseudoTrie t b -> PseudoTrie t c Source

The meet of two PseudoTries

prune :: PseudoTrie t a -> PseudoTrie t a Source

Needless intermediary elements are turned into shortcuts, Nil's in subtrees are also removed.