MemoTrie 0.4 → 0.4.1
raw patch · 3 files changed
+17/−10 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.MemoTrie: instance HasTrie Integer
Files
- MemoTrie.cabal +1/−1
- src/Data/MemoTrie.hs +7/−3
- wikipage.tw +9/−6
MemoTrie.cabal view
@@ -1,5 +1,5 @@ Name: MemoTrie-Version: 0.4+Version: 0.4.1 Cabal-Version: >= 1.2 Synopsis: Trie-based memo functions Category: Data
src/Data/MemoTrie.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE GADTs, TypeFamilies, TypeOperators, ScopedTypeVariables #-}-{-# OPTIONS_GHC -Wall -frewrite-rules #-}+{-# OPTIONS_GHC -Wall -fenable-rewrite-rules #-} -- ScopedTypeVariables works around a 6.10 bug. The forall keyword is -- supposed to be recognized in a RULES pragma. @@ -13,7 +13,7 @@ -- Stability : experimental -- -- Trie-based memoizer--- Adapted from sjanssen's paste: "a lazy trie" <http://hpaste.org/3839>.+-- Adapted from sjanssen's paste: \"a lazy trie\" <http://hpaste.org/3839>. ---------------------------------------------------------------------- module Data.MemoTrie@@ -31,7 +31,6 @@ -- import Control.Category -- import Control.Arrow - -- | Mapping from all elements of @a@ to the results of some function class HasTrie a where -- | Representation of trie with domain type @a@@@ -245,6 +244,11 @@ data Int :->: a = IntTrie (Word :->: a) untrie (IntTrie t) n = untrie t (fromIntegral n) trie f = IntTrie (trie (f . fromIntegral . toInteger))++instance HasTrie Integer where+ data Integer :->: a = IntegerTrie (Word :->: a)+ untrie (IntegerTrie t) n = untrie t (fromIntegral n)+ trie f = IntegerTrie (trie (f . fromIntegral . toInteger)) -- TODO: make these definitions more systematic.
wikipage.tw view
@@ -2,17 +2,20 @@ == Abstract == -'''MemoTrie''' is functional library for creating efficient memo functions, using [http://en.wikipedia.org/wiki/Trie trie]s. It's based on some code I got from Spencer Janssen and uses type families.+'''MemoTrie''' is functional library for creating efficient memo functions, using [http://en.wikipedia.org/wiki/Trie trie]s. It's based on [http://hpaste.org/3839 some code] from Spencer Janssen and uses type families. Besides this wiki page, here are more ways to find out about MemoTrie:-* Read [http://code.haskell.org/MemoTrie/doc/html/ the library documentation].-* Get the code repository: '''<tt>darcs get http://code.haskell.org/MemoTrie</tt>'''.-* Install from [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MemoTrie Hackage].-* See the [[MemoTrie/Versions| version history]].+* Visit the [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MemoTrie Hackage page] for library documentation and to download & install.+* Or install with <tt>cabal install MemoTrie</tt>.+* Get the code repository: <tt>darcs get http://code.haskell.org/MemoTrie</tt>.+<!-- * See the [[MemoTrie/Versions| version history]]. --> Please leave comments at the [[Talk:MemoTrie|Talk page]]. == See also == * [http://www.haskell.org/haskellwiki/GHC/Indexed_types#An_associated_data_type_example An associated data type example]-* [http://citeseer.ist.psu.edu/233124.html Generalizing Generalized Tries]+* Ralf Hinze's ''[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.46.223 Generalizing Generalized Tries]''+* Related [http://conal.net/blog/tag/tries/ blog posts].+* Use of MemoTrie in [[vector-space]].+