Data.Trie.Simple
 Portability portable. Stability volatile Maintainer jeanphilippe.bernardy; google mail.
 Contents construction construction with combining function modification conversion size testing extraction lookup
Description

Standard Trie type.

This is a derivative of Ralf Hinze, http://www.informatik.uni-bonn.de/~ralf/software/Library/Trie.html.

This module is based on plain lists. The

Synopsis
 data Trie a b empty :: Trie a b singleton :: ([a], b) -> Trie a b union :: Ord a => Trie a b -> Trie a b -> Trie a b unions :: Ord a => [Trie a b] -> Trie a b add :: Ord a => ([a], b) -> Trie a b -> Trie a b (///) :: Ord a => Trie a b -> [([a], b)] -> Trie a b delete :: Ord a => Trie a b -> [a] -> Trie a b deleteMany :: Ord a => Trie a b -> [[a]] -> Trie a b difference :: Ord a => Trie a b -> Trie a b -> Trie a b toList :: Trie a b -> [([a], b)] fromList :: Ord a => [([a], b)] -> Trie a b genericSize :: Integral a => Trie b c -> a size :: Trie a b -> Int null :: Trie a b -> Bool isSingleton :: Trie a b -> Bool elems :: Trie a b -> [b] keys :: Trie a b -> [[a]] lookup :: Ord a => Trie a b -> [a] -> Maybe b lookupWithDefault :: Ord a => Trie a b -> b -> [a] -> b lookupWithContinuation :: Ord a => Trie a b -> (b -> c) -> c -> [a] -> c prefixLookup :: Ord a => Trie a b -> [a] -> [([a], b)]
Documentation
data Trie a b
construction
empty :: Trie a b
The value associated with the empty sequence is contained in the Maybe b part. Note: Node [(a,empty)] Nothing is not legal. A trie is printed as a set of bindings of the form a |-> v.
singleton :: ([a], b) -> Trie a b
union :: Ord a => Trie a b -> Trie a b -> Trie a b
unions :: Ord a => [Trie a b] -> Trie a b
add :: Ord a => ([a], b) -> Trie a b -> Trie a b
(///) :: Ord a => Trie a b -> [([a], b)] -> Trie a b
construction with combining function
modification
delete :: Ord a => Trie a b -> [a] -> Trie a b
deleteMany :: Ord a => Trie a b -> [[a]] -> Trie a b
difference :: Ord a => Trie a b -> Trie a b -> Trie a b
conversion
toList :: Trie a b -> [([a], b)]
fromList :: Ord a => [([a], b)] -> Trie a b
size
genericSize :: Integral a => Trie b c -> a
size :: Trie a b -> Int
testing
null :: Trie a b -> Bool
isSingleton :: Trie a b -> Bool
extraction
elems :: Trie a b -> [b]
keys :: Trie a b -> [[a]]
lookup
lookup :: Ord a => Trie a b -> [a] -> Maybe b
lookupWithDefault :: Ord a => Trie a b -> b -> [a] -> b
lookupWithContinuation :: Ord a => Trie a b -> (b -> c) -> c -> [a] -> c
prefixLookup :: Ord a => Trie a b -> [a] -> [([a], b)]