pred-trie-0.2.1: Predicative tries

Safe HaskellSafe
LanguageHaskell2010

Data.Trie.Pred.Unified.Tail

Synopsis

Documentation

data UPTrie t x where Source

Constructors

UMore :: t -> Maybe x -> [UPTrie t x] -> UPTrie t x 
UPred :: t -> (t -> Maybe r) -> Maybe (r -> x) -> [UPTrie t (r -> x)] -> UPTrie t x 

Instances

Functor (UPTrie t) Source 
Foldable (UPTrie t) Source 
(Eq t, Eq x) => Eq (UPTrie t x) Source 
Show t => Show (UPTrie t x) Source

Ignores contents

Eq t => Semigroup (UPTrie t x) Source 
(Arbitrary t, Arbitrary x) => Arbitrary (UPTrie t x) Source

Can only generate literal examples

suppliment :: (t -> Maybe r) -> t -> UPTrie t (r -> x) -> Maybe (UPTrie t x) Source

Given a parser and a chunk, take a trie expecting a result, and possibly return a reduced trie without the expectation.

tagUPTrie :: UPTrie t x -> t Source

Acts as a default tag value for the node

measureDepthRelative :: ([Int] -> Int) -> UPTrie t x -> Int Source

Measure the depth of a trie, based on the relation of other adjacent depths

assignLit :: Eq t => Path t -> Maybe x -> UPTrie t x -> UPTrie t x Source

Assigns a value to literal constructors

elem :: Eq t => Path t -> UPTrie t x -> Bool Source

lookup :: Eq t => Path t -> UPTrie t x -> Maybe x Source

lookupWithL :: Eq t => (t -> t) -> Path t -> UPTrie t x -> Maybe x Source

Apply a transform f to the final path chunk, when matching a literal cell - used for eliminating file extensions in nested-routes.

lookupNearestParent :: Eq t => Path t -> UPTrie t x -> Maybe x Source

lookupThrough :: Eq t => Path t -> UPTrie t x -> [x] Source

Return all nodes passed during a lookup

firstNonEmpty :: [[a]] -> [a] Source

merge :: Eq t => UPTrie t x -> UPTrie t x -> UPTrie t x Source

Overwrites when similar, leaves untouched when not

areDisjoint :: Eq t => UPTrie t x -> UPTrie t x -> Bool Source

litSingletonTail :: Path t -> x -> UPTrie t x Source

Create a singleton trie out of literal constructors

litExtrudeTail :: [t] -> UPTrie t x -> UPTrie t x Source

Push a trie down with literal constructors

sort :: Eq t => [UPTrie t x] -> [UPTrie t x] Source

also does a non-deterministic merge - make sure your nodes are disjoint & clean