Skip to content
Browse files

Version 0.2 -> 0.2.1

 * Fixed bug with generating ListTrie and StringTrie
  • Loading branch information...
1 parent 1898b64 commit 4bcd40167ce739b9a9c92bd06a422bf31e6b66ad @baldo committed Feb 8, 2012
Showing with 7 additions and 3 deletions.
  1. +3 −0 CHANGES
  2. +1 −1 derive-trie.cabal
  3. +3 −2 src/Data/Derive/Trie.hs
View
3 CHANGES
@@ -1,3 +1,6 @@
+0.2 -> 0.2.1
+ * Fixed bug with generating ListTrie and StringTrie
+
0.1.1 -> 0.2
* Supporting GHC-7.0.* and GHC-7.2.1
* Using Haskell2010
View
2 derive-trie.cabal
@@ -1,5 +1,5 @@
Name: derive-trie
-Version: 0.2
+Version: 0.2.1
Stability: Provisional
Synopsis: Automatic derivation of Trie implementations.
Description: Automatic derivation of Trie implementations from user
View
5 src/Data/Derive/Trie.hs
@@ -58,7 +58,6 @@ import qualified Data.Map
import qualified Data.IntMap
import Data.Array
-
-- trie types for some primitive types like Int,Char, ..
prim2trie :: [(Type,Type)]
prim2trie = [(ConT ''Int, ConT ''Data.IntMap.IntMap),
@@ -432,6 +431,7 @@ isAppT _ = False
-- replaces recursively every key type by the corresponding trie type, as
-- specified in key2trie
replaceKeyByTrie :: [(Type,Type)] -> Type -> Type
+replaceKeyByTrie key2trie ListT = replaceKeyByTrie key2trie $ ConT ''[]
replaceKeyByTrie key2trie (AppT t1 t2) =
AppT (replaceKeyByTrie key2trie t1) (replaceKeyByTrie key2trie t2)
replaceKeyByTrie key2trie keyType =
@@ -603,7 +603,7 @@ getConstrsOfDataDec knownDecs dec =
DataD _ _ _ cons _ -> return cons
NewtypeD _ _ _ con _ -> return [con]
TySynD name _ t -> do
- let (ConT newname) = getOutermostTypeOfType t
+ let ConT newname = getOutermostTypeOfType t
tdec <- doReify knownDecs newname
getConstrsOfDataDec knownDecs tdec
_ -> error "Error:getConstrsOfDataDec: not implemented!"
@@ -620,6 +620,7 @@ getConstrsOfDataDec knownDecs dec =
getOutermostTypeOfType :: Type -> Type
getOutermostTypeOfType (AppT t1 t2) = getOutermostTypeOfType t1
+getOutermostTypeOfType ListT = ConT ''[]
getOutermostTypeOfType t = t
-- returns the constructor for the empty trie

0 comments on commit 4bcd401

Please sign in to comment.
Something went wrong with that request. Please try again.