MemoTrie 0.4.9 → 0.4.10
raw patch · 5 files changed
+10/−45 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.MemoTrie: class HasTrie a where { data family :->: a :: * -> *; }
+ Data.MemoTrie: class HasTrie a where data family :->: a :: * -> *
Files
- Makefile +0/−9
- MemoTrie.cabal +1/−1
- changes.tw +0/−5
- src/Data/MemoTrie.hs +9/−9
- wikipage.tw +0/−21
− Makefile
@@ -1,9 +0,0 @@-# For special configuration, especially for docs. Otherwise see README.--server = code.haskell.org-server-dir = /srv/code-server-url-dir =--# extra-configure-args += --enable-library-profiling --enable-executable-profiling--include ../my-cabal-make.inc
MemoTrie.cabal view
@@ -1,5 +1,5 @@ Name: MemoTrie-Version: 0.4.9+Version: 0.4.10 Cabal-Version: >= 1.2 Synopsis: Trie-based memo functions Category: Data
− changes.tw
@@ -1,5 +0,0 @@-== Version 0 == - -=== Version 0.0 === - -* Created. Extracted from vector-space.
src/Data/MemoTrie.hs view
@@ -140,7 +140,7 @@ ---- Instances instance HasTrie () where- data () :->: a = UnitTrie a+ newtype () :->: a = UnitTrie a trie f = UnitTrie (f ()) untrie (UnitTrie a) = \ () -> a enumerate (UnitTrie a) = [((),a)]@@ -244,7 +244,7 @@ instance (HasTrie a, HasTrie b) => HasTrie (a,b) where- data (a,b) :->: x = PairTrie (a :->: (b :->: x))+ newtype (a,b) :->: x = PairTrie (a :->: (b :->: x)) trie f = PairTrie (trie (trie . curry f)) untrie (PairTrie t) = uncurry (untrie . untrie t) enumerate (PairTrie tt) =@@ -277,7 +277,7 @@ -} instance (HasTrie a, HasTrie b, HasTrie c) => HasTrie (a,b,c) where- data (a,b,c) :->: x = TripleTrie (((a,b),c) :->: x)+ newtype (a,b,c) :->: x = TripleTrie (((a,b),c) :->: x) trie f = TripleTrie (trie (f . trip)) untrie (TripleTrie t) = untrie t . detrip enumerate (TripleTrie t) = enum' trip t@@ -290,7 +290,7 @@ instance HasTrie x => HasTrie [x] where- data [x] :->: a = ListTrie (Either () (x,[x]) :->: a)+ newtype [x] :->: a = ListTrie (Either () (x,[x]) :->: a) trie f = ListTrie (trie (f . list)) untrie (ListTrie t) = untrie t . delist enumerate (ListTrie t) = enum' list t@@ -304,7 +304,7 @@ #define WordInstance(Type,TrieType)\ instance HasTrie Type where \- data Type :->: a = TrieType ([Bool] :->: a);\+ newtype Type :->: a = TrieType ([Bool] :->: a);\ trie f = TrieType (trie (f . unbits));\ untrie (TrieType t) = untrie t . bits;\ enumerate (TrieType t) = enum' unbits t@@ -316,7 +316,7 @@ WordInstance(Word64,Word64Trie) -- instance HasTrie Word where--- data Word :->: a = WordTrie ([Bool] :->: a)+-- newtype Word :->: a = WordTrie ([Bool] :->: a) -- trie f = WordTrie (trie (f . unbits)) -- untrie (WordTrie t) = untrie t . bits -- enumerate (WordTrie t) = enum' unbits t@@ -338,7 +338,7 @@ unbits (x:xs) = unbit x .|. shiftL (unbits xs) 1 instance HasTrie Char where- data Char :->: a = CharTrie (Int :->: a)+ newtype Char :->: a = CharTrie (Int :->: a) untrie (CharTrie t) n = untrie t (fromEnum n) trie f = CharTrie (trie (f . toEnum)) enumerate (CharTrie t) = enum' toEnum t@@ -350,7 +350,7 @@ #define IntInstance(IntType,WordType,TrieType) \ instance HasTrie IntType where \- data IntType :->: a = TrieType (WordType :->: a); \+ newtype IntType :->: a = TrieType (WordType :->: a); \ untrie (TrieType t) n = untrie t (fromIntegral n); \ trie f = TrieType (trie (f . fromIntegral)); \ enumerate (TrieType t) = enum' fromIntegral t@@ -365,7 +365,7 @@ -- extract the sign bit. instance HasTrie Integer where- data Integer :->: a = IntegerTrie ((Bool,[Bool]) :->: a)+ newtype Integer :->: a = IntegerTrie ((Bool,[Bool]) :->: a) trie f = IntegerTrie (trie (f . unbitsZ)) untrie (IntegerTrie t) = untrie t . bitsZ enumerate (IntegerTrie t) = enum' unbitsZ t
− wikipage.tw
@@ -1,21 +0,0 @@-[[Category:Packages]]--== Abstract ==--'''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:-* 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]-* 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]].-