vector 0.10.11.0 → 0.10.12.0
raw patch · 9 files changed
+81/−78 lines, 9 filesdep +QuickCheckdep +randomdep +template-haskelldep ~base
Dependencies added: QuickCheck, random, template-haskell, test-framework, test-framework-quickcheck2, transformers, vector
Dependency ranges changed: base
Files
- Data/Vector/Fusion/Stream/Monadic.hs +1/−1
- Data/Vector/Fusion/Util.hs +8/−0
- Data/Vector/Primitive.hs +2/−2
- Data/Vector/Primitive/Mutable.hs +1/−1
- changelog +8/−1
- tests/Tests/Move.hs +8/−5
- tests/Tests/Vector.hs +6/−6
- tests/vector-tests.cabal +0/−57
- vector.cabal +47/−5
Data/Vector/Fusion/Stream/Monadic.hs view
@@ -1403,7 +1403,7 @@ enumFromTo_double :: (Monad m, Ord a, RealFrac a) => a -> a -> Stream m a {-# INLINE_STREAM enumFromTo_double #-}-enumFromTo_double n m = n `seq` m `seq` Stream step n (Max (len n m))+enumFromTo_double n m = n `seq` m `seq` Stream step n (Max (len n lim)) where lim = m + 1/2 -- important to float out
Data/Vector/Fusion/Util.hs view
@@ -22,6 +22,10 @@ instance Functor Id where fmap f (Id x) = Id (f x) +instance Applicative Id where+ pure = Id+ Id f <*> Id x = Id (f x)+ instance Monad Id where return = Id Id x >>= f = f x@@ -31,6 +35,10 @@ instance Functor Box where fmap f (Box x) = Box (f x)++instance Applicative Box where+ pure = Box+ Box f <*> Box x = Box (f x) instance Monad Box where return = Box
Data/Vector/Primitive.hs view
@@ -17,7 +17,7 @@ module Data.Vector.Primitive ( -- * Primitive vectors- Vector, MVector(..), Prim,+ Vector(..), MVector(..), Prim, -- * Accessors @@ -175,7 +175,7 @@ -- | Unboxed vectors of primitive types data Vector a = Vector {-# UNPACK #-} !Int {-# UNPACK #-} !Int- {-# UNPACK #-} !ByteArray+ {-# UNPACK #-} !ByteArray -- ^ offset, length, underlying byte array deriving ( Typeable ) instance NFData (Vector a)
Data/Vector/Primitive/Mutable.hs view
@@ -67,7 +67,7 @@ -- | Mutable vectors of primitive types. data MVector s a = MVector {-# UNPACK #-} !Int {-# UNPACK #-} !Int- {-# UNPACK #-} !(MutableByteArray s)+ {-# UNPACK #-} !(MutableByteArray s) -- ^ offset, length, underlying mutable byte array deriving ( Typeable ) type IOVector = MVector RealWorld
changelog view
@@ -1,6 +1,13 @@+Changes in version 0.10.12.0++ * Export MVector constructor from Data.Vector.Primitive to match Vector's+ (which was already exported).++ * Fix building on GHC 7.9 by adding Applicative instances for Id and Box+ Changes in version 0.10.11.0 -* Support OverloadedLists for boxed Vector in GHC >= 7.8+ * Support OverloadedLists for boxed Vector in GHC >= 7.8 Changes in version 0.10.10.0
tests/Tests/Move.hs view
@@ -2,7 +2,9 @@ import Test.QuickCheck import Test.Framework.Providers.QuickCheck2+import Test.QuickCheck.Property (Property(..)) + import Utilities () import qualified Data.Vector.Generic as G@@ -14,18 +16,19 @@ import qualified Data.Vector.Unboxed as U basicMove :: G.Vector v a => v a -> Int -> Int -> Int -> v a-basicMove v dstOff srcOff len +basicMove v dstOff srcOff len | len > 0 = G.modify (\ mv -> G.copy (M.slice dstOff len mv) (G.slice srcOff len v)) v | otherwise = v testMove :: (G.Vector v a, Show (v a), Eq (v a)) => v a -> Property-testMove v = G.length v > 0 ==> (do+testMove v = G.length v > 0 ==> (MkProperty $ do dstOff <- choose (0, G.length v - 1) srcOff <- choose (0, G.length v - 1) len <- choose (1, G.length v - max dstOff srcOff)- let expected = basicMove v dstOff srcOff len- let actual = G.modify (\ mv -> M.move (M.slice dstOff len mv) (M.slice srcOff len mv)) v- printTestCase ("Move: " ++ show (v, dstOff, srcOff, len)) (expected == actual))+ expected <- return $ basicMove v dstOff srcOff len+ actual <- return $ G.modify (\ mv -> M.move (M.slice dstOff len mv) (M.slice srcOff len mv)) v+ unProperty $ counterexample ("Move: " ++ show (v, dstOff, srcOff, len)) (expected == actual))+ tests = [testProperty "Data.Vector.Mutable (Move)" (testMove :: V.Vector Int -> Property),
tests/Tests/Vector.hs view
@@ -1,7 +1,7 @@ module Tests.Vector (tests) where import Boilerplater-import Utilities+import Utilities as Util import qualified Data.Vector.Generic as V import qualified Data.Vector@@ -115,7 +115,7 @@ 'prop_concat, -- Restricting memory usage- 'prop_force, + 'prop_force, -- Bulk updates (FIXME)@@ -207,7 +207,7 @@ prop_concat :: P ([v a] -> v a) = V.concat `eq` concat prop_force :: P (v a -> v a) = V.force `eq` id prop_generate :: P (Int -> (Int -> a) -> v a)- = (\n _ -> n < 1000) ===> V.generate `eq` generate+ = (\n _ -> n < 1000) ===> V.generate `eq` Util.generate prop_iterateN :: P (Int -> (a -> a) -> a -> v a) = (\n _ _ -> n < 1000) ===> V.iterateN `eq` (\n f -> take n . iterate f) @@ -335,7 +335,7 @@ V.scanl1 `eq` scanl1 prop_scanl1' :: P ((a -> a -> a) -> v a -> v a) = notNull2 ===> V.scanl1' `eq` scanl1- + prop_prescanr :: P ((a -> a -> a) -> a -> v a -> v a) = V.prescanr `eq` prescanr prop_prescanr' :: P ((a -> a -> a) -> a -> v a -> v a)@@ -373,7 +373,7 @@ --prop_mapAccumL = eq3 -- (V.mapAccumL :: (X -> W -> (X,W)) -> X -> B -> (X, B)) -- ( mapAccumL :: (X -> W -> (X,W)) -> X -> [W] -> (X, [W]))- -- + -- --prop_mapAccumR = eq3 -- (V.mapAccumR :: (X -> W -> (X,W)) -> X -> B -> (X, B)) -- ( mapAccumR :: (X -> W -> (X,W)) -> X -> [W] -> (X, [W]))@@ -507,7 +507,7 @@ where -- Prelude --prop_concat = (V.concat :: [v a] -> v a) `eq1` concat- + -- Data.List --prop_transpose = V.transpose `eq1` (transpose :: [v a] -> [v a]) --prop_group = V.group `eq1` (group :: v a -> [v a])
− tests/vector-tests.cabal
@@ -1,57 +0,0 @@-Name: vector-tests-Version: 0.10.0.1-License: BSD3-License-File: LICENSE-Author: Max Bolingbroke, Roman Leshchinskiy-Maintainer: Roman Leshchinskiy <rl@cse.unsw.edu.au>-Copyright: (c) Max Bolinbroke, Roman Leshchinskiy 2008-2012-Homepage: http://darcs.haskell.org/vector-Category: Data Structures-Synopsis: Efficient Arrays-Description:- Tests for the vector package--Cabal-Version: >= 1.6-Build-Type: Simple---Executable "vector-tests-O0"- Main-Is: Main.hs-- Build-Depends: base >= 4 && < 5, template-haskell, vector == 0.10.9.1,- random,- QuickCheck >= 2, test-framework, test-framework-quickcheck2-- Extensions: CPP,- ScopedTypeVariables,- PatternGuards,- MultiParamTypeClasses,- FlexibleContexts,- Rank2Types,- TypeSynonymInstances,- TypeFamilies,- TemplateHaskell-- Ghc-Options: -O0- Ghc-Options: -Wall -fno-warn-orphans -fno-warn-missing-signatures--Executable "vector-tests-O2"- Main-Is: Main.hs-- Build-Depends: base >= 4 && < 5, template-haskell, vector == 0.10.9.1,- random,- QuickCheck >= 2, test-framework, test-framework-quickcheck2-- Extensions: CPP,- ScopedTypeVariables,- PatternGuards,- MultiParamTypeClasses,- FlexibleContexts,- Rank2Types,- TypeSynonymInstances,- TypeFamilies,- TemplateHaskell-- Ghc-Options: -O2- Ghc-Options: -Wall -fno-warn-orphans -fno-warn-missing-signatures-
vector.cabal view
@@ -1,5 +1,5 @@ Name: vector-Version: 0.10.11.0+Version: 0.10.12.0 -- don't forget to update the changelog file! License: BSD3 License-File: LICENSE@@ -34,12 +34,11 @@ . * <http://haskell.org/haskellwiki/Numeric_Haskell:_A_Vector_Tutorial> -Cabal-Version: >= 1.6+Cabal-Version: >= 1.10 Build-Type: Simple Extra-Source-Files: README.md- tests/vector-tests.cabal tests/LICENSE tests/Setup.hs tests/Main.hs@@ -86,7 +85,8 @@ Library- Extensions: CPP, DeriveDataTypeable+ Default-Language: Haskell2010+ Default-Extensions: CPP, DeriveDataTypeable Exposed-Modules: Data.Vector.Internal.Check @@ -127,7 +127,7 @@ if impl(ghc<6.13) Ghc-Options: -finline-if-enough-args -fno-method-sharing- + Ghc-Options: -O2 if flag(BoundsChecks)@@ -142,3 +142,45 @@ source-repository head type: git location: https://github.com/haskell/vector.git++test-suite vector-tests-O0+ Default-Language: Haskell2010+ type: exitcode-stdio-1.0+ Main-Is: Main.hs+ hs-source-dirs: tests+ Build-Depends: base >= 4 && < 5, template-haskell, vector,+ random,+ QuickCheck >= 2.7 && < 2.8 , test-framework, test-framework-quickcheck2,+ transformers >= 0.2.0.0+ default-extensions: CPP,+ ScopedTypeVariables,+ PatternGuards,+ MultiParamTypeClasses,+ FlexibleContexts,+ Rank2Types,+ TypeSynonymInstances,+ TypeFamilies,+ TemplateHaskell+ Ghc-Options: -O0+ Ghc-Options: -Wall -fno-warn-orphans -fno-warn-missing-signatures++test-suite vector-tests-O2+ Default-Language: Haskell2010+ type: exitcode-stdio-1.0+ Main-Is: Main.hs+ hs-source-dirs: tests+ Build-Depends: base >= 4 && < 5, template-haskell, vector,+ random,+ QuickCheck >= 2.7, test-framework, test-framework-quickcheck2,+ transformers >= 0.2.0.0+ default-extensions: CPP,+ ScopedTypeVariables,+ PatternGuards,+ MultiParamTypeClasses,+ FlexibleContexts,+ Rank2Types,+ TypeSynonymInstances,+ TypeFamilies,+ TemplateHaskell+ Ghc-Options: -O2+ Ghc-Options: -Wall -fno-warn-orphans -fno-warn-missing-signatures