This module provides the template to automatically derive a
Trie implementation from a data type, which uses this data type
as key. The template generates a trie data type and an instance of the
KeyMap
class for every given key, as described in the paper
"Efficient, Modular Tries" by Sebastian Fischer and Frank Huch is
generated using Template Haskell.
Usage:
import Data.Derive.Trie import Data.KeyMap ... $(deriveTrie [''<keytypename1>,''<keytypename2>,..])
You will also need to enable the following language extensions:
- MultiParamTypeClasses - TemplateHaskell - UndecidableInstances
And if you want to derive Tries structures for type synonyms you will also need:
- TypeSynonymInstances
- deriveTrie :: [Name] -> Q [Dec]
- tidy :: KeyMap key map => map val -> map val
- ensureTrie :: KeyMap key map => Maybe (map val) -> map val
- trieToMaybe :: KeyMap key map => map val -> Maybe (map val)