-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A lazy, infinite trie of integers. -- -- A simple lazy, infinite trie from integers. @package data-inttrie @version 0.1.0 -- | Provides a minimal infinite, lazy trie for integral types. It -- intentionally leaves out ideas such as delete and emptiness so that it -- can be used lazily, eg. as the target of an infinite foldr. -- Essentially its purpose is to be an efficient implementation of a -- function from integral type, given point-at-a-time modifications. module Data.IntTrie -- | A trie from integers to values of type a. -- -- Semantics: [[IntTrie a]] = Integer -> a data IntTrie a -- | The identity trie. -- -- <pre> -- apply identity = id -- </pre> identity :: (Num a, Bits a) => IntTrie a -- | Apply the trie to an argument. This is the semantic map. apply :: (Ord b, Num b, Bits b) => IntTrie a -> b -> a -- | Modify the function at one point -- -- <pre> -- apply (modify x f t) i | i == x = f (apply t i) -- | otherwise = apply t i -- </pre> modify :: (Ord b, Num b, Bits b) => b -> (a -> a) -> IntTrie a -> IntTrie a -- | Modify the function at one point (strict version) modify' :: (Ord b, Num b, Bits b) => b -> (a -> a) -> IntTrie a -> IntTrie a -- | Overwrite the function at one point -- -- <pre> -- overwrite i x = modify i (const x) -- </pre> overwrite :: (Ord b, Num b, Bits b) => b -> a -> IntTrie a -> IntTrie a instance Monoid a => Monoid (IntTrie a) instance Applicative IntTrie instance Functor IntTrie instance Monoid a => Monoid (BitTrie a) instance Applicative BitTrie instance Functor BitTrie