Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Trie a = Branch !a !(Map Word (Trie a))
- type Rule = Maybe Int
- nilTrie :: Trie Rule
- updRule :: Int -> Maybe Int -> Maybe Int
- insert :: Int -> [Word] -> Trie Rule -> Trie Rule
- listToTrie :: [(Int, String)] -> Trie Rule
- mindepths :: Trie Rule -> Trie (Rule, Int)
- data Trie' a
- pathify :: Trie (Rule, Int) -> Trie' (Rule, Int)
- fallbacks :: Trie' (Rule, Int) -> Trie' (Rule, Int, Int)
- ensureBytes :: Trie' (Rule, Int, Int) -> Trie' (Rule, Int, Maybe Int)
- compileTrie :: [(Int, String)] -> Trie' (Rule, Int, Maybe Int)
Documentation
mindepths :: Trie Rule -> Trie (Rule, Int) Source #
Decorate a trie with the minimum lengths of non-empty paths. This
is used later to place ensureBytes#
.
fallbacks :: Trie' (Rule, Int) -> Trie' (Rule, Int, Int) Source #
Compute where to fall back after we exhausted a branch. If the branch is empty, that means we've succeded at reading and we jump to the rhs rule.