License | GPL-2 |
---|---|
Maintainer | fuuzetsu@fuuzetsu.co.uk |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Extensions |
|
Data.Trie
Description
Synopsis
- empty :: Trie
- insert :: String -> Trie -> Trie
- fromString :: String -> Trie
- fromList :: [String] -> Trie
- toList :: Trie -> [String]
- lookupPrefix :: MonadPlus m => String -> Trie -> m Trie
- forcedNext :: Trie -> String
- data Trie
- possibleSuffixes :: String -> Trie -> [String]
- certainSuffix :: String -> Trie -> String
Documentation
fromString :: String -> Trie Source #
lookupPrefix :: MonadPlus m => String -> Trie -> m Trie Source #
Takes a trie and a prefix and returns the sub-trie that of words with that prefix
forcedNext :: Trie -> String Source #
Finds the longest certain path down the trie starting at a the root
Invariant Assumption: All paths have at least one true
node below them
Instances
Eq Trie Source # | |
Show Trie Source # | |
Generic Trie Source # | |
Binary Trie Source # | |
type Rep Trie Source # | |
Defined in Data.Trie type Rep Trie = D1 ('MetaData "Trie" "Data.Trie" "word-trie-0.3.0-JIPK5vXawH53KWTtp8vGOv" 'False) (C1 ('MetaCons "Trie" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Char Trie)))) |
possibleSuffixes :: String -> Trie -> [String] Source #
Helper function, finds all the suffixes of a given prefix
certainSuffix :: String -> Trie -> String Source #
Helper function, finds the longest certain path down the trie starting at a given word