MemoTrie 0.4.5 → 0.4.7
raw patch · 2 files changed
+7/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.MemoTrie: instance HasTrie Char
Files
- MemoTrie.cabal +2/−2
- src/Data/MemoTrie.hs +5/−0
MemoTrie.cabal view
@@ -1,5 +1,5 @@ Name: MemoTrie-Version: 0.4.5+Version: 0.4.7 Cabal-Version: >= 1.2 Synopsis: Trie-based memo functions Category: Data@@ -22,7 +22,7 @@ Library hs-Source-Dirs: src Extensions: - Build-Depends: base+ Build-Depends: base < 5 Exposed-Modules: Data.MemoTrie ghc-options: -Wall
src/Data/MemoTrie.hs view
@@ -296,6 +296,11 @@ unbits [] = 0 unbits (x:xs) = unbit x .|. shiftL (unbits xs) 1 +instance HasTrie Char where+ data 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 -- Although Int is a Bits instance, we can't use bits directly for -- memoizing, because the "bits" function gives an infinite result, since