summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouisWasserman <>2013-04-18 23:58:55 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2013-04-18 23:58:55 (GMT)
commit1a410ee62dbacac0c157dd3fba0da12b98bfa9db (patch)
tree9d8ac685ca6293b6b1d3539265d6cc68ceb85ae1
parent1a41b2612fcfb197f8da8431080c1963d57a6092 (diff)
version 4.1.0HEAD4.1.0master
-rw-r--r--Data/TrieMap/OrdMap.hs6
-rw-r--r--Data/TrieMap/RadixTrie/Edge.hs2
-rw-r--r--Data/TrieMap/Representation/Instances.hs3
-rw-r--r--Data/TrieMap/Representation/Instances/Foreign.hs27
-rw-r--r--Data/TrieMap/Representation/TH/ReprMonad.hs25
-rw-r--r--Data/TrieMap/WordMap.hs6
-rw-r--r--TrieMap.cabal5
7 files changed, 26 insertions, 48 deletions
diff --git a/Data/TrieMap/OrdMap.hs b/Data/TrieMap/OrdMap.hs
index 4affea3..cb9690c 100644
--- a/Data/TrieMap/OrdMap.hs
+++ b/Data/TrieMap/OrdMap.hs
@@ -38,9 +38,9 @@ instance ImmoralCast a a where
deriving instance ImmoralCast a (Elem a)
instance Sized a => Sized (Node k a) where
- getSize# m = unbox $ case m of
+ getSize# m = unbox (case m of
Tip -> 0
- Bin _ a l r -> getSize a + getSize l + getSize r
+ Bin _ a l r -> getSize a + getSize l + getSize r)
instance Sized (SNode k a) where
getSize# SNode{sz} = unbox sz
@@ -433,4 +433,4 @@ search k t f g = searcher Root t where
searcher path BIN(kx x l r) = case compare k kx of
LT -> searcher (LeftBin kx x path r) l
EQ -> g x (Full k path l r)
- GT -> searcher (RightBin kx x l path) r \ No newline at end of file
+ GT -> searcher (RightBin kx x l path) r
diff --git a/Data/TrieMap/RadixTrie/Edge.hs b/Data/TrieMap/RadixTrie/Edge.hs
index df9312f..9f2d25a 100644
--- a/Data/TrieMap/RadixTrie/Edge.hs
+++ b/Data/TrieMap/RadixTrie/Edge.hs
@@ -341,4 +341,4 @@ fromAscListEdge f = case inline daFold of
edge ks vK $ inline doneB $ snocBranch brK kChar stack'
_ -> error "Error: bad stack"
- done = Just . roll \ No newline at end of file
+ done = Just . roll
diff --git a/Data/TrieMap/Representation/Instances.hs b/Data/TrieMap/Representation/Instances.hs
index de52bed..7bc4046 100644
--- a/Data/TrieMap/Representation/Instances.hs
+++ b/Data/TrieMap/Representation/Instances.hs
@@ -18,7 +18,6 @@ import Data.TrieMap.Representation.Instances.Prim ()
import Data.TrieMap.Representation.Instances.Basic ()
import Data.TrieMap.Representation.Instances.ByteString ()
import Data.TrieMap.Representation.Instances.Vectors ()
-import Data.TrieMap.Representation.Instances.Foreign ()
import Data.TrieMap.Representation.TH
#define DefList(ty) \
@@ -55,4 +54,4 @@ unroll :: Integer -> P.Vector Word
unroll x = P.reverse (P.unfoldr split x)
where wSize = bitSize (0 :: Word)
split 0 = Nothing
- split x = Just (fromIntegral x :: Word, shiftR x wSize) \ No newline at end of file
+ split x = Just (fromIntegral x :: Word, shiftR x wSize)
diff --git a/Data/TrieMap/Representation/Instances/Foreign.hs b/Data/TrieMap/Representation/Instances/Foreign.hs
deleted file mode 100644
index 9049cac..0000000
--- a/Data/TrieMap/Representation/Instances/Foreign.hs
+++ /dev/null
@@ -1,27 +0,0 @@
-{-# LANGUAGE TemplateHaskell, TypeFamilies, UndecidableInstances #-}
-module Data.TrieMap.Representation.Instances.Foreign () where
-
-import Foreign.C.Types
-import Data.TrieMap.Representation.Instances.Prim ()
-import Data.TrieMap.Representation.Instances.Basic ()
-import Data.TrieMap.Representation.TH
-
-genRepr ''CChar
-genRepr ''CSChar
-genRepr ''CUChar
-genRepr ''CShort
-genRepr ''CUShort
-genRepr ''CInt
-genRepr ''CUInt
-genRepr ''CLong
-genRepr ''CULong
-genRepr ''CPtrdiff
-genRepr ''CSize
-genRepr ''CWchar
-genRepr ''CSigAtomic
-genRepr ''CLLong
-genRepr ''CULLong
-genRepr ''CClock
-genRepr ''CTime
-genRepr ''CFloat
-genRepr ''CDouble \ No newline at end of file
diff --git a/Data/TrieMap/Representation/TH/ReprMonad.hs b/Data/TrieMap/Representation/TH/ReprMonad.hs
index 811270f..423a417 100644
--- a/Data/TrieMap/Representation/TH/ReprMonad.hs
+++ b/Data/TrieMap/Representation/TH/ReprMonad.hs
@@ -11,6 +11,7 @@ module Data.TrieMap.Representation.TH.ReprMonad (
import Data.TrieMap.Representation.Class
import Data.TrieMap.Representation.TH.Utils
+import Control.Applicative
import Control.Monad
import Language.Haskell.TH.Syntax
import Language.Haskell.TH.ExpandSyns
@@ -34,19 +35,25 @@ instance Monad ReprMonad where
instance Functor ReprMonad where
fmap = liftM
+instance Applicative ReprMonad where
+ pure = return
+ (<*>) = ap
+
liftQuasi :: Q a -> ReprMonad a
liftQuasi q = ReprMonad $ \ knowns _ -> do
a <- q
return ([], knowns, a)
instance Quasi ReprMonad where
- qNewName = liftQuasi . qNewName
- qReport b str = liftQuasi (qReport b str)
- qRecover m k = ReprMonad $ \ knowns breaks -> qRecover (runReprMonad m knowns breaks) (runReprMonad k knowns breaks)
- qReify = liftQuasi . qReify
- qClassInstances name typs = liftQuasi (qClassInstances name typs)
- qLocation = liftQuasi qLocation
- qRunIO = liftQuasi . qRunIO
+ qNewName = liftQuasi . qNewName
+ qReport b str = liftQuasi (qReport b str)
+ qRecover m k = ReprMonad $ \ knowns breaks -> qRecover (runReprMonad m knowns breaks) (runReprMonad k knowns breaks)
+ qLookupName b str = liftQuasi (qLookupName b str)
+ qReify = liftQuasi . qReify
+ qReifyInstances name typs = liftQuasi (qReifyInstances name typs)
+ qLocation = liftQuasi qLocation
+ qRunIO = liftQuasi . qRunIO
+ qAddDependentFile = liftQuasi . qAddDependentFile
insNub :: Eq a => a -> [a] -> [a]
insNub x ys0@(y:ys)
@@ -77,6 +84,6 @@ execReprMonad :: ReprMonad a -> Q [Dec]
execReprMonad m = do
ClassI _ instances <- reify ''Repr
let instanceHeads = [(tyConName, (tyArgs, ConT ''Rep `AppT` compose tyConName tyArgs))
- | ClassInstance{ci_tys = [decompose' -> Just (tyConName, tyArgs)]} <- instances]
+ | (InstanceD _ (decompose' -> Just (tyConName, tyArgs)) _) <- instances]
(decs, _, _) <- runReprMonad m instanceHeads []
- return decs \ No newline at end of file
+ return decs
diff --git a/Data/TrieMap/WordMap.hs b/Data/TrieMap/WordMap.hs
index 608faee..07d4a32 100644
--- a/Data/TrieMap/WordMap.hs
+++ b/Data/TrieMap/WordMap.hs
@@ -41,10 +41,10 @@ instance Sized (SNode a) where
getSize# SNode{sz} = unbox sz
instance Sized a => Sized (Node a) where
- getSize# t = unbox $ case t of
+ getSize# t = unbox (case t of
Nil -> 0
Tip _ a -> getSize a
- Bin _ _ l r -> getSize l + getSize r
+ Bin _ _ l r -> getSize l + getSize r)
{-# INLINE sNode #-}
sNode :: Sized a => Node a -> SNode a
@@ -457,4 +457,4 @@ fromAscList f = Foldl{zero = nil, ..} where
p = mask p1 m
data WordStack a = WordStack !Key a (Stack a)
-data Stack a = Push !Prefix !(SNode a) !(Stack a) | Nada \ No newline at end of file
+data Stack a = Push !Prefix !(SNode a) !(Stack a) | Nada
diff --git a/TrieMap.cabal b/TrieMap.cabal
index 39fd47f..3781202 100644
--- a/TrieMap.cabal
+++ b/TrieMap.cabal
@@ -1,5 +1,5 @@
name: TrieMap
-version: 4.0.1
+version: 4.1.0
cabal-version: >= 1.6
tested-with: GHC
category: Algorithms
@@ -29,7 +29,7 @@ Flag LLVM {
}
Library{
-build-Depends: base < 5.0.0.0, containers, template-haskell >= 2.5.0.0, bytestring >= 0.9.1.0, th-expand-syns,
+build-Depends: base < 5.0.0.0, containers, template-haskell >= 2.7.0.0, bytestring >= 0.9.1.0, th-expand-syns,
vector >= 0.6, primitive >= 0.3, unpack-funcs >= 0.1.2, transformers >= 0.2.0.0
ghc-options:
-Wall -fno-warn-name-shadowing -fno-warn-orphans -fno-spec-constr-count -fno-spec-constr-threshold
@@ -63,7 +63,6 @@ other-modules:
Data.TrieMap.Representation.Instances,
Data.TrieMap.Representation.Instances.Basic,
Data.TrieMap.Representation.Instances.Prim,
- Data.TrieMap.Representation.Instances.Foreign,
Data.TrieMap.Representation.Instances.Vectors,
Data.TrieMap.Representation.Instances.ByteString
Data.TrieMap.WordMap,