MemoTrie-0.4.1: Trie-based memo functions




Trie-based memoizer Adapted from sjanssen's paste: "a lazy trie"



class HasTrie a whereSource

Mapping from all elements of a to the results of some function

Associated Types

data :->: a :: * -> *Source

Representation of trie with domain type a


trie :: (a -> b) -> a :->: bSource

untrie :: (a :->: b) -> a -> bSource

Convert a trie to a function, i.e., access a field of the trie


HasTrie Bool 
HasTrie Int 
HasTrie Integer 
HasTrie Word 
HasTrie () 
HasTrie x => HasTrie [x] 
(HasTrie a, HasTrie b) => HasTrie (Either a b) 
(HasTrie a, HasTrie b) => HasTrie (a, b) 
(HasTrie a, HasTrie b, HasTrie c) => HasTrie (a, b, c) 

memo :: HasTrie t => (t -> a) -> t -> aSource

Trie-based function memoizer

memo2 :: (HasTrie s, HasTrie t) => (s -> t -> a) -> s -> t -> aSource

Memoize a binary function, on its first argument and then on its second. Take care to exploit any partial evaluation.

memo3 :: (HasTrie r, HasTrie s, HasTrie t) => (r -> s -> t -> a) -> r -> s -> t -> aSource

Memoize a ternary function on successive arguments. Take care to exploit any partial evaluation.

mup :: HasTrie t => (b -> c) -> (t -> b) -> t -> cSource

Lift a memoizer to work with one more argument.