Safe Haskell | None |
---|

- type TrieD a b = Trie a (Maybe b)
- data Trie a b = Trie {}
- unTrie :: Trie a b -> (b, [(a, Trie a b)])
- child :: Ord a => a -> Trie a b -> Maybe (Trie a b)
- anyChild :: Trie a b -> [(a, Trie a b)]
- mkTrie :: Ord a => b -> [(a, Trie a b)] -> Trie a b
- setValue :: b -> Trie a b -> Trie a b
- substChild :: Ord a => a -> Trie a b -> Trie a b -> Trie a b
- insert :: Ord a => [a] -> b -> TrieD a b -> TrieD a b
- size :: Trie a b -> Int
- follow :: Ord a => [a] -> Trie a b -> Maybe (Trie a b)
- lookup :: Ord a => [a] -> TrieD a b -> Maybe b
- fromLang :: Ord a => [[a]] -> TrieD a ()
- fromList :: Ord a => [([a], b)] -> TrieD a b
- toList :: TrieD a b -> [([a], b)]
- serialize :: (Ord a, Ord b) => Trie a b -> [Node a b]
- deserialize :: Ord a => [Node a b] -> Trie a b
- implicitDAWG :: (Ord a, Ord b) => Trie a b -> Trie a b

# Documentation

A trie of words with character type `a`

and entry type `b`

. It can be
thought of as a map of type `[a] -> b`

.

fromList :: Ord a => [([a], b)] -> TrieD a bSource

Construct the `Trie`

from the list of (word, value) pairs.

serialize :: (Ord a, Ord b) => Trie a b -> [Node a b]Source

Serialize the trie and eliminate all common subtries along the way. TODO: perhaps the function name should be different?

deserialize :: Ord a => [Node a b] -> Trie a bSource

FIXME: Null node list case.