derive-trie-0.2: Automatic derivation of Trie implementations.

Data.Derive.Trie

Contents

Description

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

Synopsis

Deriving Trie structures

Used in generated code

tidy :: KeyMap key map => map val -> map valSource

ensureTrie :: KeyMap key map => Maybe (map val) -> map valSource

trieToMaybe :: KeyMap key map => map val -> Maybe (map val)Source