Skip to content

Commit ef1215b

Browse files
committed
Merge branch 'master' into new_travis
Fixes test failures.
2 parents 285cbf5 + 944c158 commit ef1215b

File tree

4 files changed

+23
-75
lines changed

4 files changed

+23
-75
lines changed

Data/Vector/Generic.hs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,15 +1757,15 @@ iscanl :: (Vector v a, Vector v b) => (Int -> a -> b -> a) -> a -> v b -> v a
17571757
{-# INLINE iscanl #-}
17581758
iscanl f z =
17591759
unstream
1760-
. inplace (S.scanl (\a (i, b) -> f i a b) z . S.indexed) id
1760+
. inplace (S.scanl (\a (i, b) -> f i a b) z . S.indexed) (+1)
17611761
. stream
17621762

17631763
-- | /O(n)/ Scan over a vector (strictly) with its index
17641764
iscanl' :: (Vector v a, Vector v b) => (Int -> a -> b -> a) -> a -> v b -> v a
17651765
{-# INLINE iscanl' #-}
17661766
iscanl' f z =
17671767
unstream
1768-
. inplace (S.scanl' (\a (i, b) -> f i a b) z . S.indexed) id
1768+
. inplace (S.scanl' (\a (i, b) -> f i a b) z . S.indexed) (+1)
17691769
. stream
17701770

17711771

@@ -1822,18 +1822,22 @@ scanr' f z = unstreamR . Bundle.scanl' (flip f) z . streamR
18221822
-- | /O(n)/ Right-to-left scan over a vector with its index
18231823
iscanr :: (Vector v a, Vector v b) => (Int -> a -> b -> b) -> b -> v a -> v b
18241824
{-# INLINE iscanr #-}
1825-
iscanr f z =
1825+
iscanr f z v =
18261826
unstreamR
1827-
. inplace (S.scanl (flip $ uncurry f) z . S.indexed) id
1827+
. inplace (S.scanl (flip $ uncurry f) z . S.indexedR n) (+1)
18281828
. streamR
1829+
$ v
1830+
where n = length v
18291831

18301832
-- | /O(n)/ Right-to-left scan over a vector (strictly) with its index
18311833
iscanr' :: (Vector v a, Vector v b) => (Int -> a -> b -> b) -> b -> v a -> v b
18321834
{-# INLINE iscanr' #-}
1833-
iscanr' f z =
1835+
iscanr' f z v =
18341836
unstreamR
1835-
. inplace (S.scanl' (flip $ uncurry f) z . S.indexed) id
1837+
. inplace (S.scanl' (flip $ uncurry f) z . S.indexedR n) (+1)
18361838
. streamR
1839+
$ v
1840+
where n = length v
18371841

18381842
-- | /O(n)/ Right-to-left scan over a non-empty vector
18391843
scanr1 :: Vector v a => (a -> a -> a) -> v a -> v a

tests/Utilities.hs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ instance Arbitrary a => Arbitrary (S.Bundle v a) where
5252
instance CoArbitrary a => CoArbitrary (S.Bundle v a) where
5353
coarbitrary = coarbitrary . S.toList
5454

55-
instance Arbitrary a => Arbitrary (Identity a) where
56-
arbitrary = fmap Identity arbitrary
57-
58-
instance CoArbitrary a => CoArbitrary (Identity a) where
59-
coarbitrary = coarbitrary . runIdentity
60-
6155
instance Arbitrary a => Arbitrary (Writer a ()) where
6256
arbitrary = fmap (writer . ((,) ())) arbitrary
6357

@@ -219,7 +213,7 @@ notNullS2 _ s = not $ S.null s
219213

220214
-- Generators
221215
index_value_pairs :: Arbitrary a => Int -> Gen [(Int,a)]
222-
index_value_pairs 0 = return []
216+
index_value_pairs 0 = return []
223217
index_value_pairs m = sized $ \n ->
224218
do
225219
len <- choose (0,n)
@@ -254,7 +248,7 @@ accum f xs ps = go xs ps' 0
254248
go (x:xs) ((i,y) : ps) j
255249
| i == j = go (f x y : xs) ps j
256250
go (x:xs) ps j = x : go xs ps (j+1)
257-
go [] _ _ = []
251+
go [] _ _ = []
258252

259253
(//) :: [a] -> [(Int, a)] -> [a]
260254
xs // ps = go xs ps' 0

tests/vector-tests.cabal

Lines changed: 0 additions & 59 deletions
This file was deleted.

vector.cabal

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ Library
156156

157157
Ghc-Options: -O2 -Wall -fno-warn-orphans
158158

159+
if impl(ghc >= 8.0) && impl( ghc < 8.1)
160+
Ghc-Options: -Wno-redundant-constraints
161+
159162
if flag(BoundsChecks)
160163
cpp-options: -DVECTOR_BOUNDS_CHECKS
161164

@@ -178,7 +181,7 @@ test-suite vector-tests-O0
178181
hs-source-dirs: tests
179182
Build-Depends: base >= 4 && < 5, template-haskell, vector,
180183
random,
181-
QuickCheck >= 2.7 && < 2.8 , test-framework, test-framework-quickcheck2,
184+
QuickCheck >= 2.9 && < 2.10 , test-framework, test-framework-quickcheck2,
182185
transformers >= 0.2.0.0
183186

184187
default-extensions: CPP,
@@ -193,6 +196,9 @@ test-suite vector-tests-O0
193196

194197
Ghc-Options: -O0
195198
Ghc-Options: -Wall -fno-warn-orphans -fno-warn-missing-signatures
199+
if impl(ghc >= 8.0) && impl( ghc < 8.1)
200+
Ghc-Options: -Wno-redundant-constraints
201+
196202

197203
test-suite vector-tests-O2
198204
Default-Language: Haskell2010
@@ -201,7 +207,7 @@ test-suite vector-tests-O2
201207
hs-source-dirs: tests
202208
Build-Depends: base >= 4 && < 5, template-haskell, vector,
203209
random,
204-
QuickCheck >= 2.7, test-framework, test-framework-quickcheck2,
210+
QuickCheck >= 2.9 && < 2.10 , test-framework, test-framework-quickcheck2,
205211
transformers >= 0.2.0.0
206212

207213
default-extensions: CPP,
@@ -215,4 +221,7 @@ test-suite vector-tests-O2
215221
TemplateHaskell
216222

217223
Ghc-Options: -O2
224+
if impl(ghc >= 8.0) && impl( ghc < 8.1)
225+
Ghc-Options: -Wno-redundant-constraints
226+
218227
Ghc-Options: -Wall -fno-warn-orphans -fno-warn-missing-signatures

0 commit comments

Comments
 (0)