@@ -21,7 +21,7 @@ import Test.Hspec
22import Streamly
22import Streamly
23import Streamly.Prelude ((.:), nil)
23import Streamly.Prelude ((.:), nil)
24−import qualified Streamly.Prelude as A
24+import qualified Streamly.Prelude as S
26maxTestCount :: Int
26maxTestCount :: Int
27#ifdef DEVBUILD
27#ifdef DEVBUILD
@@ -54,7 +54,7 @@ constructWithReplicateM
54constructWithReplicateM op len =
54constructWithReplicateM op len =
55 monadicIO $ do
55 monadicIO $ do
56 let x = return (1 :: Int)
56 let x = return (1 :: Int)
57− stream <- run $ (A.toList . op) (A.replicateM (fromIntegral len) x)
57+ stream <- run $ (S.toList . op) (S.replicateM (fromIntegral len) x)
58 list <- run $ replicateM (fromIntegral len) x
58 list <- run $ replicateM (fromIntegral len) x
59 equals (==) stream list
59 equals (==) stream list
@@ -67,7 +67,7 @@ transformFromList
67 -> Property
67 -> Property
68transformFromList constr eq listOp op a =
68transformFromList constr eq listOp op a =
69 monadicIO $ do
69 monadicIO $ do
70− stream <- run ((A.toList . op) (constr a))
70+ stream <- run ((S.toList . op) (constr a))
71 let list = listOp a
71 let list = listOp a
72 equals eq stream list
72 equals eq stream list
@@ -105,7 +105,7 @@ concurrentMapM constr eq op n =
105 let list = [0..n]
105 let list = [0..n]
106 stream <- run $ do
106 stream <- run $ do
107 mv <- newEmptyMVar :: IO (MVar ())
107 mv <- newEmptyMVar :: IO (MVar ())
108− (A.toList . (op n mv)) (constr list)
108+ (S.toList . (op n mv)) (constr list)
109 equals eq stream list
109 equals eq stream list
111concurrentFromFoldable
111concurrentFromFoldable
@@ -119,11 +119,11 @@ concurrentFromFoldable eq op n =
119 let list = [0..n]
119 let list = [0..n]
120 stream <- run $ do
120 stream <- run $ do
121 mv <- newEmptyMVar :: IO (MVar ())
121 mv <- newEmptyMVar :: IO (MVar ())
122− (A.toList . op) (A.fromFoldableM (map (mvarSequenceOp mv n) list))
122+ (S.toList . op) (S.fromFoldableM (map (mvarSequenceOp mv n) list))
123 equals eq stream list
123 equals eq stream list
125sourceUnfoldrM :: IsStream t => MVar () -> Word8 -> t IO Word8
125sourceUnfoldrM :: IsStream t => MVar () -> Word8 -> t IO Word8
126−sourceUnfoldrM mv n = A.unfoldrM step 0
126+sourceUnfoldrM mv n = S.unfoldrM step 0
128 -- argument must be integer to avoid overflow of word8 at 255
128 -- argument must be integer to avoid overflow of word8 at 255
129 step :: Int -> IO (Maybe (Word8, Int))
129 step :: Int -> IO (Maybe (Word8, Int))
@@ -154,15 +154,15 @@ concurrentUnfoldrM eq op n =
154 -- since unfoldr happens in parallel with the stream processing we
154 -- since unfoldr happens in parallel with the stream processing we
155 -- can do two takeMVar in one iteration. If it is not parallel then
155 -- can do two takeMVar in one iteration. If it is not parallel then
156 -- this will not work and the test will fail.
156 -- this will not work and the test will fail.
157− A.toList $ do
157+ S.toList $ do
158 x <- op (sourceUnfoldrM mv n)
158 x <- op (sourceUnfoldrM mv n)
159 -- results may not be yielded in order, in case of
159 -- results may not be yielded in order, in case of
160 -- Async/WAsync/Parallel. So we use an increasing count
160 -- Async/WAsync/Parallel. So we use an increasing count
161 -- instead.
161 -- instead.
162− i <- A.yieldM $ readIORef cnt
162+ i <- S.yieldM $ readIORef cnt
163− A.yieldM $ modifyIORef cnt (+1)
163+ S.yieldM $ modifyIORef cnt (+1)
164 let msg = show i ++ "/" ++ show n
164 let msg = show i ++ "/" ++ show n
165− A.yieldM $ do
165+ S.yieldM $ do
166 if even i
166 if even i
168 dbgMVar ("first take concurrentUnfoldrM " ++ msg)
168 dbgMVar ("first take concurrentUnfoldrM " ++ msg)
@@ -187,9 +187,9 @@ concurrentApplication n =
187 -- since unfoldr happens in parallel with the stream processing we
187 -- since unfoldr happens in parallel with the stream processing we
188 -- can do two takeMVar in one iteration. If it is not parallel then
188 -- can do two takeMVar in one iteration. If it is not parallel then
189 -- this will not work and the test will fail.
189 -- this will not work and the test will fail.
190− A.toList $ do
190+ S.toList $ do
191 sourceUnfoldrM mv n |&
191 sourceUnfoldrM mv n |&
192− (A.mapM $ \x -> do
192+ (S.mapM $ \x -> do
193 let msg = show x ++ "/" ++ show n
193 let msg = show x ++ "/" ++ show n
194 if even x
194 if even x
@@ -204,7 +204,7 @@ concurrentApplication n =
204 equals (==) stream list
204 equals (==) stream list
206sourceUnfoldrM1 :: IsStream t => Word8 -> t IO Word8
206sourceUnfoldrM1 :: IsStream t => Word8 -> t IO Word8
207−sourceUnfoldrM1 n = A.unfoldrM step 0
207+sourceUnfoldrM1 n = S.unfoldrM step 0
209 -- argument must be integer to avoid overflow of word8 at 255
209 -- argument must be integer to avoid overflow of word8 at 255
210 step :: Int -> IO (Maybe (Word8, Int))
210 step :: Int -> IO (Maybe (Word8, Int))
@@ -219,7 +219,7 @@ concurrentFoldlApplication n =
219 -- XXX we should test empty list case as well
219 -- XXX we should test empty list case as well
220 let list = [0..n]
220 let list = [0..n]
221 stream <- run $ do
221 stream <- run $ do
222− sourceUnfoldrM1 n |&. A.foldlM' (\xs x -> return (x : xs)) []
222+ sourceUnfoldrM1 n |&. S.foldlM' (\xs x -> return (x : xs)) []
223 equals (==) (reverse stream) list
223 equals (==) (reverse stream) list
225concurrentFoldrApplication :: Word8 -> Property
225concurrentFoldrApplication :: Word8 -> Property
@@ -228,7 +228,7 @@ concurrentFoldrApplication n =
228 -- XXX we should test empty list case as well
228 -- XXX we should test empty list case as well
229 let list = [0..n]
229 let list = [0..n]
230 stream <- run $ do
230 stream <- run $ do
231− sourceUnfoldrM1 n |&. A.foldrM (\x xs -> return (x : xs)) []
231+ sourceUnfoldrM1 n |&. S.foldrM (\x xs -> return (x : xs)) []
232 equals (==) stream list
232 equals (==) stream list
234transformCombineFromList
234transformCombineFromList
@@ -244,7 +244,7 @@ transformCombineFromList
244 -> Property
244 -> Property
245transformCombineFromList constr eq listOp t op a b c =
245transformCombineFromList constr eq listOp t op a b c =
246 monadicIO $ do
246 monadicIO $ do
247− stream <- run ((A.toList . t) $
247+ stream <- run ((S.toList . t) $
248 constr a <> op (constr b <> constr c))
248 constr a <> op (constr b <> constr c))
249 let list = a <> listOp (b <> c)
249 let list = a <> listOp (b <> c)
250 equals eq stream list
250 equals eq stream list
@@ -305,42 +305,42 @@ transformOps constr desc t eq = do
305 let transform = transformFromList constr eq
305 let transform = transformFromList constr eq
306 -- Filtering
306 -- Filtering
307 prop (desc ++ " filter False") $
307 prop (desc ++ " filter False") $
308− transform (filter (const False)) $ t . (A.filter (const False))
308+ transform (filter (const False)) $ t . (S.filter (const False))
309 prop (desc ++ " filter True") $
309 prop (desc ++ " filter True") $
310− transform (filter (const True)) $ t . (A.filter (const True))
310+ transform (filter (const True)) $ t . (S.filter (const True))
311 prop (desc ++ " filter even") $
311 prop (desc ++ " filter even") $
312− transform (filter even) $ t . (A.filter even)
312+ transform (filter even) $ t . (S.filter even)
314 prop (desc ++ " take maxBound") $
314 prop (desc ++ " take maxBound") $
315− transform (take maxBound) $ t . (A.take maxBound)
315+ transform (take maxBound) $ t . (S.take maxBound)
316− prop (desc ++ " take 0") $ transform (take 0) $ t . (A.take 0)
316+ prop (desc ++ " take 0") $ transform (take 0) $ t . (S.take 0)
317− prop (desc ++ " take 1") $ transform (take 1) $ t . (A.take 1)
317+ prop (desc ++ " take 1") $ transform (take 1) $ t . (S.take 1)
318− prop (desc ++ " take 10") $ transform (take 10) $ t . (A.take 10)
318+ prop (desc ++ " take 10") $ transform (take 10) $ t . (S.take 10)
320 prop (desc ++ " takeWhile True") $
320 prop (desc ++ " takeWhile True") $
321− transform (takeWhile (const True)) $ t . (A.takeWhile (const True))
321+ transform (takeWhile (const True)) $ t . (S.takeWhile (const True))
322 prop (desc ++ " takeWhile False") $
322 prop (desc ++ " takeWhile False") $
323− transform (takeWhile (const False)) $ t . (A.takeWhile (const False))
323+ transform (takeWhile (const False)) $ t . (S.takeWhile (const False))
324 prop (desc ++ " takeWhile > 0") $
324 prop (desc ++ " takeWhile > 0") $
325− transform (takeWhile (> 0)) $ t . (A.takeWhile (> 0))
325+ transform (takeWhile (> 0)) $ t . (S.takeWhile (> 0))
327 let f x = if odd x then Just (x + 100) else Nothing
327 let f x = if odd x then Just (x + 100) else Nothing
328− prop (desc ++ " mapMaybe") $ transform (mapMaybe f) $ t . (A.mapMaybe f)
328+ prop (desc ++ " mapMaybe") $ transform (mapMaybe f) $ t . (S.mapMaybe f)
330 prop (desc ++ " drop maxBound") $
330 prop (desc ++ " drop maxBound") $
331− transform (drop maxBound) $ t . (A.drop maxBound)
331+ transform (drop maxBound) $ t . (S.drop maxBound)
332− prop (desc ++ " drop 0") $ transform (drop 0) $ t . (A.drop 0)
332+ prop (desc ++ " drop 0") $ transform (drop 0) $ t . (S.drop 0)
333− prop (desc ++ " drop 1") $ transform (drop 1) $ t . (A.drop 1)
333+ prop (desc ++ " drop 1") $ transform (drop 1) $ t . (S.drop 1)
334− prop (desc ++ " drop 10") $ transform (drop 10) $ t . (A.drop 10)
334+ prop (desc ++ " drop 10") $ transform (drop 10) $ t . (S.drop 10)
336 prop (desc ++ " dropWhile True") $
336 prop (desc ++ " dropWhile True") $
337− transform (dropWhile (const True)) $ t . (A.dropWhile (const True))
337+ transform (dropWhile (const True)) $ t . (S.dropWhile (const True))
338 prop (desc ++ " dropWhile False") $
338 prop (desc ++ " dropWhile False") $
339− transform (dropWhile (const False)) $ t . (A.dropWhile (const False))
339+ transform (dropWhile (const False)) $ t . (S.dropWhile (const False))
340 prop (desc ++ " dropWhile > 0") $
340 prop (desc ++ " dropWhile > 0") $
341− transform (dropWhile (> 0)) $ t . (A.dropWhile (> 0))
341+ transform (dropWhile (> 0)) $ t . (S.dropWhile (> 0))
342− prop (desc ++ " scan") $ transform (scanl' (+) 0) $ t . (A.scanl' (+) 0)
342+ prop (desc ++ " scan") $ transform (scanl' (+) 0) $ t . (S.scanl' (+) 0)
343− prop (desc ++ " reverse") $ transform reverse $ t . A.reverse
343+ prop (desc ++ " reverse") $ transform reverse $ t . S.reverse
345concurrentOps
345concurrentOps
346 :: IsStream t
346 :: IsStream t
@@ -362,7 +362,7 @@ concurrentOps constr desc t eq = do
362 -- then it will block even if it is concurrent.
362 -- then it will block even if it is concurrent.
363 prop (desc ++ " mapM") $ withMaxSuccess maxTestCount $
363 prop (desc ++ " mapM") $ withMaxSuccess maxTestCount $
364 concurrentMapM constr eq $ \n mv stream ->
364 concurrentMapM constr eq $ \n mv stream ->
365− t $ A.mapM (mvarSequenceOp mv n) stream
365+ t $ S.mapM (mvarSequenceOp mv n) stream
367-- XXX add tests for MonadReader and MonadError etc. In case an SVar is
367-- XXX add tests for MonadReader and MonadError etc. In case an SVar is
368-- accidentally passed through them.
368-- accidentally passed through them.
@@ -377,32 +377,32 @@ transformCombineOpsCommon constr desc t eq = do
377 let transform = transformCombineFromList constr eq
377 let transform = transformCombineFromList constr eq
378 -- Filtering
378 -- Filtering
379 prop (desc ++ " filter False") $
379 prop (desc ++ " filter False") $
380− transform (filter (const False)) t (A.filter (const False))
380+ transform (filter (const False)) t (S.filter (const False))
381 prop (desc ++ " filter True") $
381 prop (desc ++ " filter True") $
382− transform (filter (const True)) t (A.filter (const True))
382+ transform (filter (const True)) t (S.filter (const True))
383 prop (desc ++ " filter even") $
383 prop (desc ++ " filter even") $
384− transform (filter even) t (A.filter even)
384+ transform (filter even) t (S.filter even)
386 prop (desc ++ " take maxBound") $
386 prop (desc ++ " take maxBound") $
387− transform (take maxBound) t (A.take maxBound)
387+ transform (take maxBound) t (S.take maxBound)
388− prop (desc ++ " take 0") $ transform (take 0) t (A.take 0)
388+ prop (desc ++ " take 0") $ transform (take 0) t (S.take 0)
390 prop (desc ++ " takeWhile True") $
390 prop (desc ++ " takeWhile True") $
391− transform (takeWhile (const True)) t (A.takeWhile (const True))
391+ transform (takeWhile (const True)) t (S.takeWhile (const True))
392 prop (desc ++ " takeWhile False") $
392 prop (desc ++ " takeWhile False") $
393− transform (takeWhile (const False)) t (A.takeWhile (const False))
393+ transform (takeWhile (const False)) t (S.takeWhile (const False))
395 prop (desc ++ " drop maxBound") $
395 prop (desc ++ " drop maxBound") $
396− transform (drop maxBound) t (A.drop maxBound)
396+ transform (drop maxBound) t (S.drop maxBound)
397− prop (desc ++ " drop 0") $ transform (drop 0) t (A.drop 0)
397+ prop (desc ++ " drop 0") $ transform (drop 0) t (S.drop 0)
399 prop (desc ++ " dropWhile True") $
399 prop (desc ++ " dropWhile True") $
400− transform (dropWhile (const True)) t (A.dropWhile (const True))
400+ transform (dropWhile (const True)) t (S.dropWhile (const True))
401 prop (desc ++ " dropWhile False") $
401 prop (desc ++ " dropWhile False") $
402− transform (dropWhile (const False)) t (A.dropWhile (const False))
402+ transform (dropWhile (const False)) t (S.dropWhile (const False))
403 prop (desc ++ " scan") $ transform (scanl' (flip const) 0) t
403 prop (desc ++ " scan") $ transform (scanl' (flip const) 0) t
404− (A.scanl' (flip const) 0)
404+ (S.scanl' (flip const) 0)
405− prop (desc ++ " reverse") $ transform reverse t A.reverse
405+ prop (desc ++ " reverse") $ transform reverse t S.reverse
407transformCombineOpsOrdered
407transformCombineOpsOrdered
408 :: (IsStream t, Semigroup (t IO Int))
408 :: (IsStream t, Semigroup (t IO Int))
@@ -414,18 +414,18 @@ transformCombineOpsOrdered
414transformCombineOpsOrdered constr desc t eq = do
414transformCombineOpsOrdered constr desc t eq = do
415 let transform = transformCombineFromList constr eq
415 let transform = transformCombineFromList constr eq
416 -- Filtering
416 -- Filtering
417− prop (desc ++ " take 1") $ transform (take 1) t (A.take 1)
417+ prop (desc ++ " take 1") $ transform (take 1) t (S.take 1)
418− prop (desc ++ " take 10") $ transform (take 10) t (A.take 10)
418+ prop (desc ++ " take 10") $ transform (take 10) t (S.take 10)
420 prop (desc ++ " takeWhile > 0") $
420 prop (desc ++ " takeWhile > 0") $
421− transform (takeWhile (> 0)) t (A.takeWhile (> 0))
421+ transform (takeWhile (> 0)) t (S.takeWhile (> 0))
423− prop (desc ++ " drop 1") $ transform (drop 1) t (A.drop 1)
423+ prop (desc ++ " drop 1") $ transform (drop 1) t (S.drop 1)
424− prop (desc ++ " drop 10") $ transform (drop 10) t (A.drop 10)
424+ prop (desc ++ " drop 10") $ transform (drop 10) t (S.drop 10)
426 prop (desc ++ " dropWhile > 0") $
426 prop (desc ++ " dropWhile > 0") $
427− transform (dropWhile (> 0)) t (A.dropWhile (> 0))
427+ transform (dropWhile (> 0)) t (S.dropWhile (> 0))
428− prop (desc ++ " scan") $ transform (scanl' (+) 0) t (A.scanl' (+) 0)
428+ prop (desc ++ " scan") $ transform (scanl' (+) 0) t (S.scanl' (+) 0)
430wrapMaybe :: Eq a1 => ([a1] -> a2) -> [a1] -> Maybe a2
430wrapMaybe :: Eq a1 => ([a1] -> a2) -> [a1] -> Maybe a2
431wrapMaybe f =
431wrapMaybe f =
@@ -441,17 +441,17 @@ eliminationOps
442eliminationOps constr desc t = do
442eliminationOps constr desc t = do
443 -- Elimination
443 -- Elimination
444− prop (desc ++ " null") $ eliminateOp constr null $ A.null . t
444+ prop (desc ++ " null") $ eliminateOp constr null $ S.null . t
445 prop (desc ++ " foldl") $
445 prop (desc ++ " foldl") $
446− eliminateOp constr (foldl' (+) 0) $ (A.foldl' (+) 0) . t
446+ eliminateOp constr (foldl' (+) 0) $ (S.foldl' (+) 0) . t
447− prop (desc ++ " all") $ eliminateOp constr (all even) $ (A.all even) . t
447+ prop (desc ++ " all") $ eliminateOp constr (all even) $ (S.all even) . t
448− prop (desc ++ " any") $ eliminateOp constr (any even) $ (A.any even) . t
448+ prop (desc ++ " any") $ eliminateOp constr (any even) $ (S.any even) . t
449− prop (desc ++ " length") $ eliminateOp constr length $ A.length . t
449+ prop (desc ++ " length") $ eliminateOp constr length $ S.length . t
450− prop (desc ++ " sum") $ eliminateOp constr sum $ A.sum . t
450+ prop (desc ++ " sum") $ eliminateOp constr sum $ S.sum . t
451− prop (desc ++ " product") $ eliminateOp constr product $ A.product . t
451+ prop (desc ++ " product") $ eliminateOp constr product $ S.product . t
453− prop (desc ++ " maximum") $ eliminateOp constr (wrapMaybe maximum) $ A.maximum . t
453+ prop (desc ++ " maximum") $ eliminateOp constr (wrapMaybe maximum) $ S.maximum . t
454− prop (desc ++ " minimum") $ eliminateOp constr (wrapMaybe minimum) $ A.minimum . t
454+ prop (desc ++ " minimum") $ eliminateOp constr (wrapMaybe minimum) $ S.minimum . t
456-- head/tail/last may depend on the order in case of parallel streams
456-- head/tail/last may depend on the order in case of parallel streams
457-- so we test these only for serial streams.
457-- so we test these only for serial streams.
@@ -461,13 +461,13 @@ serialEliminationOps
461 -> (t IO Int -> SerialT IO Int)
461 -> (t IO Int -> SerialT IO Int)
463serialEliminationOps constr desc t = do
463serialEliminationOps constr desc t = do
464− prop (desc ++ " head") $ eliminateOp constr (wrapMaybe head) $ A.head . t
464+ prop (desc ++ " head") $ eliminateOp constr (wrapMaybe head) $ S.head . t
465 prop (desc ++ " tail") $ eliminateOp constr (wrapMaybe tail) $ \x -> do
465 prop (desc ++ " tail") $ eliminateOp constr (wrapMaybe tail) $ \x -> do
466− r <- A.tail (t x)
466+ r <- S.tail (t x)
467 case r of
467 case r of
468 Nothing -> return Nothing
468 Nothing -> return Nothing
469− Just s -> A.toList s >>= return . Just
469+ Just s -> S.toList s >>= return . Just
470− prop (desc ++ " last") $ eliminateOp constr (wrapMaybe last) $ A.last . t
470+ prop (desc ++ " last") $ eliminateOp constr (wrapMaybe last) $ S.last . t
472transformOpsWord8
472transformOpsWord8
473 :: ([Word8] -> t IO Word8)
473 :: ([Word8] -> t IO Word8)
@@ -475,8 +475,8 @@ transformOpsWord8
475 -> (t IO Word8 -> SerialT IO Word8)
475 -> (t IO Word8 -> SerialT IO Word8)
477transformOpsWord8 constr desc t = do
477transformOpsWord8 constr desc t = do
478− prop (desc ++ " elem") $ elemOp constr t A.elem elem
478+ prop (desc ++ " elem") $ elemOp constr t S.elem elem
479− prop (desc ++ " elem") $ elemOp constr t A.notElem notElem
479+ prop (desc ++ " elem") $ elemOp constr t S.notElem notElem
481-- XXX concatenate streams of multiple elements rather than single elements
481-- XXX concatenate streams of multiple elements rather than single elements
482semigroupOps
482semigroupOps
@@ -503,7 +503,7 @@ applicativeOps
503 -> Property
503 -> Property
504applicativeOps constr t eq (a, b) = withMaxSuccess maxTestCount $
504applicativeOps constr t eq (a, b) = withMaxSuccess maxTestCount $
505 monadicIO $ do
505 monadicIO $ do
506− stream <- run ((A.toList . t) ((,) <$> (constr a) <*> (constr b)))
506+ stream <- run ((S.toList . t) ((,) <$> (constr a) <*> (constr b)))
507 let list = (,) <$> a <*> b
507 let list = (,) <$> a <*> b
508 equals eq stream list
508 equals eq stream list
@@ -516,9 +516,9 @@ zipApplicative
516 -> Property
516 -> Property
517zipApplicative constr t eq (a, b) = withMaxSuccess maxTestCount $
517zipApplicative constr t eq (a, b) = withMaxSuccess maxTestCount $
518 monadicIO $ do
518 monadicIO $ do
519− stream1 <- run ((A.toList . t) ((,) <$> (constr a) <*> (constr b)))
519+ stream1 <- run ((S.toList . t) ((,) <$> (constr a) <*> (constr b)))
520− stream2 <- run ((A.toList . t) (pure (,) <*> (constr a) <*> (constr b)))
520+ stream2 <- run ((S.toList . t) (pure (,) <*> (constr a) <*> (constr b)))
521− stream3 <- run ((A.toList . t) (A.zipWith (,) (constr a) (constr b)))
521+ stream3 <- run ((S.toList . t) (S.zipWith (,) (constr a) (constr b)))
522 let list = getZipList $ (,) <$> ZipList a <*> ZipList b
522 let list = getZipList $ (,) <$> ZipList a <*> ZipList b
523 equals eq stream1 list
523 equals eq stream1 list
524 equals eq stream2 list
524 equals eq stream2 list
@@ -535,12 +535,12 @@ zipMonadic constr t eq (a, b) = withMaxSuccess maxTestCount $
535 monadicIO $ do
535 monadicIO $ do
536 stream1 <-
536 stream1 <-
538− ((A.toList . t)
538+ ((S.toList . t)
539− (A.zipWithM (\x y -> return (x, y)) (constr a) (constr b)))
539+ (S.zipWithM (\x y -> return (x, y)) (constr a) (constr b)))
540 stream2 <-
540 stream2 <-
542− ((A.toList . t)
542+ ((S.toList . t)
543− (A.zipAsyncWithM (\x y -> return (x, y)) (constr a) (constr b)))
543+ (S.zipAsyncWithM (\x y -> return (x, y)) (constr a) (constr b)))
544 let list = getZipList $ (,) <$> ZipList a <*> ZipList b
544 let list = getZipList $ (,) <$> ZipList a <*> ZipList b
545 equals eq stream1 list
545 equals eq stream1 list
546 equals eq stream2 list
546 equals eq stream2 list
@@ -553,7 +553,7 @@ monadThen
553 -> ([Int], [Int])
553 -> ([Int], [Int])
554 -> Property
554 -> Property
555monadThen constr t eq (a, b) = withMaxSuccess maxTestCount $ monadicIO $ do
555monadThen constr t eq (a, b) = withMaxSuccess maxTestCount $ monadicIO $ do
556− stream <- run ((A.toList . t) ((constr a) >> (constr b)))
556+ stream <- run ((S.toList . t) ((constr a) >> (constr b)))
557 let list = a >> b
557 let list = a >> b
558 equals eq stream list
558 equals eq stream list
@@ -568,7 +568,7 @@ monadBind constr t eq (a, b) = withMaxSuccess maxTestCount $
568 monadicIO $ do
568 monadicIO $ do
569 stream <-
569 stream <-
571− ((A.toList . t)
571+ ((S.toList . t)
572 ((constr a) >>= \x -> (constr b) >>= return . (+ x)))
572 ((constr a) >>= \x -> (constr b) >>= return . (+ x)))
573 let list = a >>= \x -> b >>= return . (+ x)
573 let list = a >>= \x -> b >>= return . (+ x)
574 equals eq stream list
574 equals eq stream list
@@ -585,30 +585,30 @@ main = hspec $ do
585 -- XXX test for all types of streams
585 -- XXX test for all types of streams
586 prop "serially replicateM" $ constructWithReplicateM serially
586 prop "serially replicateM" $ constructWithReplicateM serially
587 it "iterate" $
587 it "iterate" $
588− (A.toList . serially . (A.take 100) $ (A.iterate (+ 1) (0 :: Int)))
588+ (S.toList . serially . (S.take 100) $ (S.iterate (+ 1) (0 :: Int)))
589 `shouldReturn` (take 100 $ iterate (+ 1) 0)
589 `shouldReturn` (take 100 $ iterate (+ 1) 0)
591 it "iterateM" $ do
591 it "iterateM" $ do
592 let addM = (\ y -> return (y + 1))
592 let addM = (\ y -> return (y + 1))
593− A.toList . serially . (A.take 100) $ A.iterateM addM (0 :: Int)
593+ S.toList . serially . (S.take 100) $ S.iterateM addM (0 :: Int)
594 `shouldReturn` (take 100 $ iterate (+ 1) 0)
594 `shouldReturn` (take 100 $ iterate (+ 1) 0)
596 describe "Functor operations" $ do
596 describe "Functor operations" $ do
597− functorOps A.fromFoldable "serially" serially (==)
597+ functorOps S.fromFoldable "serially" serially (==)
598 functorOps folded "serially folded" serially (==)
598 functorOps folded "serially folded" serially (==)
599− functorOps A.fromFoldable "wSerially" wSerially (==)
599+ functorOps S.fromFoldable "wSerially" wSerially (==)
600 functorOps folded "wSerially folded" wSerially (==)
600 functorOps folded "wSerially folded" wSerially (==)
601− functorOps A.fromFoldable "aheadly" aheadly (==)
601+ functorOps S.fromFoldable "aheadly" aheadly (==)
602 functorOps folded "aheadly folded" aheadly (==)
602 functorOps folded "aheadly folded" aheadly (==)
603− functorOps A.fromFoldable "asyncly" asyncly sortEq
603+ functorOps S.fromFoldable "asyncly" asyncly sortEq
604 functorOps folded "asyncly folded" asyncly sortEq
604 functorOps folded "asyncly folded" asyncly sortEq
605− functorOps A.fromFoldable "wAsyncly" wAsyncly sortEq
605+ functorOps S.fromFoldable "wAsyncly" wAsyncly sortEq
606 functorOps folded "wAsyncly folded" wAsyncly sortEq
606 functorOps folded "wAsyncly folded" wAsyncly sortEq
607− functorOps A.fromFoldable "parallely" parallely sortEq
607+ functorOps S.fromFoldable "parallely" parallely sortEq
608 functorOps folded "parallely folded" parallely sortEq
608 functorOps folded "parallely folded" parallely sortEq
609− functorOps A.fromFoldable "zipSerially" zipSerially (==)
609+ functorOps S.fromFoldable "zipSerially" zipSerially (==)
610 functorOps folded "zipSerially folded" zipSerially (==)
610 functorOps folded "zipSerially folded" zipSerially (==)
611− functorOps A.fromFoldable "zipAsyncly" zipAsyncly (==)
611+ functorOps S.fromFoldable "zipAsyncly" zipAsyncly (==)
612 functorOps folded "zipAsyncly folded" zipAsyncly (==)
612 functorOps folded "zipAsyncly folded" zipAsyncly (==)
614 describe "Semigroup operations" $ do
614 describe "Semigroup operations" $ do
@@ -625,43 +625,43 @@ main = hspec $ do
625 -- The tests using sorted equality are weaker tests
625 -- The tests using sorted equality are weaker tests
626 -- We need to have stronger unit tests for all those
626 -- We need to have stronger unit tests for all those
627 -- XXX applicative with three arguments
627 -- XXX applicative with three arguments
628− prop "serially applicative" $ applicativeOps A.fromFoldable serially (==)
628+ prop "serially applicative" $ applicativeOps S.fromFoldable serially (==)
629 prop "serially applicative folded" $ applicativeOps folded serially (==)
629 prop "serially applicative folded" $ applicativeOps folded serially (==)
630− prop "aheadly applicative" $ applicativeOps A.fromFoldable aheadly (==)
630+ prop "aheadly applicative" $ applicativeOps S.fromFoldable aheadly (==)
631 prop "aheadly applicative folded" $ applicativeOps folded aheadly (==)
631 prop "aheadly applicative folded" $ applicativeOps folded aheadly (==)
632− prop "wSerially applicative" $ applicativeOps A.fromFoldable wSerially sortEq
632+ prop "wSerially applicative" $ applicativeOps S.fromFoldable wSerially sortEq
633 prop "wSerially applicative folded" $ applicativeOps folded wSerially sortEq
633 prop "wSerially applicative folded" $ applicativeOps folded wSerially sortEq
634− prop "asyncly applicative" $ applicativeOps A.fromFoldable asyncly sortEq
634+ prop "asyncly applicative" $ applicativeOps S.fromFoldable asyncly sortEq
635 prop "asyncly applicative folded" $ applicativeOps folded asyncly sortEq
635 prop "asyncly applicative folded" $ applicativeOps folded asyncly sortEq
636 prop "wAsyncly applicative folded" $ applicativeOps folded wAsyncly sortEq
636 prop "wAsyncly applicative folded" $ applicativeOps folded wAsyncly sortEq
637 prop "parallely applicative folded" $ applicativeOps folded parallely sortEq
637 prop "parallely applicative folded" $ applicativeOps folded parallely sortEq
639 describe "Zip operations" $ do
639 describe "Zip operations" $ do
640− prop "zipSerially applicative" $ zipApplicative A.fromFoldable zipSerially (==)
640+ prop "zipSerially applicative" $ zipApplicative S.fromFoldable zipSerially (==)
641 prop "zipSerially applicative folded" $ zipApplicative folded zipSerially (==)
641 prop "zipSerially applicative folded" $ zipApplicative folded zipSerially (==)
642− prop "zipAsyncly applicative" $ zipApplicative A.fromFoldable zipAsyncly (==)
642+ prop "zipAsyncly applicative" $ zipApplicative S.fromFoldable zipAsyncly (==)
643 prop "zipAsyncly applicative folded" $ zipApplicative folded zipAsyncly (==)
643 prop "zipAsyncly applicative folded" $ zipApplicative folded zipAsyncly (==)
645− prop "zip monadic serially" $ zipMonadic A.fromFoldable serially (==)
645+ prop "zip monadic serially" $ zipMonadic S.fromFoldable serially (==)
646 prop "zip monadic serially folded" $ zipMonadic folded serially (==)
646 prop "zip monadic serially folded" $ zipMonadic folded serially (==)
647− prop "zip monadic aheadly" $ zipMonadic A.fromFoldable aheadly (==)
647+ prop "zip monadic aheadly" $ zipMonadic S.fromFoldable aheadly (==)
648 prop "zip monadic aheadly folded" $ zipMonadic folded aheadly (==)
648 prop "zip monadic aheadly folded" $ zipMonadic folded aheadly (==)
649− prop "zip monadic wSerially" $ zipMonadic A.fromFoldable wSerially (==)
649+ prop "zip monadic wSerially" $ zipMonadic S.fromFoldable wSerially (==)
650 prop "zip monadic wSerially folded" $ zipMonadic folded wSerially (==)
650 prop "zip monadic wSerially folded" $ zipMonadic folded wSerially (==)
651− prop "zip monadic asyncly" $ zipMonadic A.fromFoldable asyncly (==)
651+ prop "zip monadic asyncly" $ zipMonadic S.fromFoldable asyncly (==)
652 prop "zip monadic asyncly folded" $ zipMonadic folded asyncly (==)
652 prop "zip monadic asyncly folded" $ zipMonadic folded asyncly (==)
653− prop "zip monadic wAsyncly" $ zipMonadic A.fromFoldable wAsyncly (==)
653+ prop "zip monadic wAsyncly" $ zipMonadic S.fromFoldable wAsyncly (==)
654 prop "zip monadic wAsyncly folded" $ zipMonadic folded wAsyncly (==)
654 prop "zip monadic wAsyncly folded" $ zipMonadic folded wAsyncly (==)
655− prop "zip monadic parallely" $ zipMonadic A.fromFoldable parallely (==)
655+ prop "zip monadic parallely" $ zipMonadic S.fromFoldable parallely (==)
656 prop "zip monadic parallely folded" $ zipMonadic folded parallely (==)
656 prop "zip monadic parallely folded" $ zipMonadic folded parallely (==)
658 describe "Monad operations" $ do
658 describe "Monad operations" $ do
659− prop "serially monad then" $ monadThen A.fromFoldable serially (==)
659+ prop "serially monad then" $ monadThen S.fromFoldable serially (==)
660− prop "aheadly monad then" $ monadThen A.fromFoldable aheadly (==)
660+ prop "aheadly monad then" $ monadThen S.fromFoldable aheadly (==)
661− prop "wSerially monad then" $ monadThen A.fromFoldable wSerially sortEq
661+ prop "wSerially monad then" $ monadThen S.fromFoldable wSerially sortEq
662− prop "asyncly monad then" $ monadThen A.fromFoldable asyncly sortEq
662+ prop "asyncly monad then" $ monadThen S.fromFoldable asyncly sortEq
663− prop "wAsyncly monad then" $ monadThen A.fromFoldable wAsyncly sortEq
663+ prop "wAsyncly monad then" $ monadThen S.fromFoldable wAsyncly sortEq
664− prop "parallely monad then" $ monadThen A.fromFoldable parallely sortEq
664+ prop "parallely monad then" $ monadThen S.fromFoldable parallely sortEq
666 prop "serially monad then folded" $ monadThen folded serially (==)
666 prop "serially monad then folded" $ monadThen folded serially (==)
667 prop "aheadly monad then folded" $ monadThen folded aheadly (==)
667 prop "aheadly monad then folded" $ monadThen folded aheadly (==)
@@ -670,22 +670,22 @@ main = hspec $ do
670 prop "wAsyncly monad then folded" $ monadThen folded wAsyncly sortEq
670 prop "wAsyncly monad then folded" $ monadThen folded wAsyncly sortEq
671 prop "parallely monad then folded" $ monadThen folded parallely sortEq
671 prop "parallely monad then folded" $ monadThen folded parallely sortEq
673− prop "serially monad bind" $ monadBind A.fromFoldable serially (==)
673+ prop "serially monad bind" $ monadBind S.fromFoldable serially (==)
674− prop "aheadly monad bind" $ monadBind A.fromFoldable aheadly (==)
674+ prop "aheadly monad bind" $ monadBind S.fromFoldable aheadly (==)
675− prop "wSerially monad bind" $ monadBind A.fromFoldable wSerially sortEq
675+ prop "wSerially monad bind" $ monadBind S.fromFoldable wSerially sortEq
676− prop "asyncly monad bind" $ monadBind A.fromFoldable asyncly sortEq
676+ prop "asyncly monad bind" $ monadBind S.fromFoldable asyncly sortEq
677− prop "wAsyncly monad bind" $ monadBind A.fromFoldable wAsyncly sortEq
677+ prop "wAsyncly monad bind" $ monadBind S.fromFoldable wAsyncly sortEq
678− prop "parallely monad bind" $ monadBind A.fromFoldable parallely sortEq
678+ prop "parallely monad bind" $ monadBind S.fromFoldable parallely sortEq
680 describe "Stream transform operations" $ do
680 describe "Stream transform operations" $ do
681− transformOps A.fromFoldable "serially" serially (==)
681+ transformOps S.fromFoldable "serially" serially (==)
682− transformOps A.fromFoldable "aheadly" aheadly (==)
682+ transformOps S.fromFoldable "aheadly" aheadly (==)
683− transformOps A.fromFoldable "wSerially" wSerially (==)
683+ transformOps S.fromFoldable "wSerially" wSerially (==)
684− transformOps A.fromFoldable "zipSerially" zipSerially (==)
684+ transformOps S.fromFoldable "zipSerially" zipSerially (==)
685− transformOps A.fromFoldable "zipAsyncly" zipAsyncly (==)
685+ transformOps S.fromFoldable "zipAsyncly" zipAsyncly (==)
686− transformOps A.fromFoldable "asyncly" asyncly sortEq
686+ transformOps S.fromFoldable "asyncly" asyncly sortEq
687− transformOps A.fromFoldable "wAsyncly" wAsyncly sortEq
687+ transformOps S.fromFoldable "wAsyncly" wAsyncly sortEq
688− transformOps A.fromFoldable "parallely" parallely sortEq
688+ transformOps S.fromFoldable "parallely" parallely sortEq
690 transformOps folded "serially folded" serially (==)
690 transformOps folded "serially folded" serially (==)
691 transformOps folded "aheadly folded" aheadly (==)
691 transformOps folded "aheadly folded" aheadly (==)
@@ -696,14 +696,14 @@ main = hspec $ do
696 transformOps folded "wAsyncly folded" wAsyncly sortEq
696 transformOps folded "wAsyncly folded" wAsyncly sortEq
697 transformOps folded "parallely folded" parallely sortEq
697 transformOps folded "parallely folded" parallely sortEq
699− transformOpsWord8 A.fromFoldable "serially" serially
699+ transformOpsWord8 S.fromFoldable "serially" serially
700− transformOpsWord8 A.fromFoldable "aheadly" aheadly
700+ transformOpsWord8 S.fromFoldable "aheadly" aheadly
701− transformOpsWord8 A.fromFoldable "wSerially" wSerially
701+ transformOpsWord8 S.fromFoldable "wSerially" wSerially
702− transformOpsWord8 A.fromFoldable "zipSerially" zipSerially
702+ transformOpsWord8 S.fromFoldable "zipSerially" zipSerially
703− transformOpsWord8 A.fromFoldable "zipAsyncly" zipAsyncly
703+ transformOpsWord8 S.fromFoldable "zipAsyncly" zipAsyncly
704− transformOpsWord8 A.fromFoldable "asyncly" asyncly
704+ transformOpsWord8 S.fromFoldable "asyncly" asyncly
705− transformOpsWord8 A.fromFoldable "wAsyncly" wAsyncly
705+ transformOpsWord8 S.fromFoldable "wAsyncly" wAsyncly
706− transformOpsWord8 A.fromFoldable "parallely" parallely
706+ transformOpsWord8 S.fromFoldable "parallely" parallely
708 transformOpsWord8 folded "serially folded" serially
708 transformOpsWord8 folded "serially folded" serially
709 transformOpsWord8 folded "aheadly folded" aheadly
709 transformOpsWord8 folded "aheadly folded" aheadly
@@ -716,10 +716,10 @@ main = hspec $ do
717 -- XXX add tests with outputQueue size set to 1
717 -- XXX add tests with outputQueue size set to 1
718 describe "Stream concurrent operations" $ do
718 describe "Stream concurrent operations" $ do
719− concurrentOps A.fromFoldable "aheadly" aheadly (==)
719+ concurrentOps S.fromFoldable "aheadly" aheadly (==)
720− concurrentOps A.fromFoldable "asyncly" asyncly sortEq
720+ concurrentOps S.fromFoldable "asyncly" asyncly sortEq
721− concurrentOps A.fromFoldable "wAsyncly" wAsyncly sortEq
721+ concurrentOps S.fromFoldable "wAsyncly" wAsyncly sortEq
722− concurrentOps A.fromFoldable "parallely" parallely sortEq
722+ concurrentOps S.fromFoldable "parallely" parallely sortEq
724 concurrentOps folded "aheadly folded" aheadly (==)
724 concurrentOps folded "aheadly folded" aheadly (==)
725 concurrentOps folded "asyncly folded" asyncly sortEq
725 concurrentOps folded "asyncly folded" asyncly sortEq
@@ -736,14 +736,14 @@ main = hspec $ do
736 -- These tests are specifically targeted towards detecting illegal sharing
736 -- These tests are specifically targeted towards detecting illegal sharing
737 -- of SVar across conurrent streams.
737 -- of SVar across conurrent streams.
738 describe "Stream transform and combine operations" $ do
738 describe "Stream transform and combine operations" $ do
739− transformCombineOpsCommon A.fromFoldable "serially" serially (==)
739+ transformCombineOpsCommon S.fromFoldable "serially" serially (==)
740− transformCombineOpsCommon A.fromFoldable "aheadly" aheadly (==)
740+ transformCombineOpsCommon S.fromFoldable "aheadly" aheadly (==)
741− transformCombineOpsCommon A.fromFoldable "wSerially" wSerially sortEq
741+ transformCombineOpsCommon S.fromFoldable "wSerially" wSerially sortEq
742− transformCombineOpsCommon A.fromFoldable "zipSerially" zipSerially (==)
742+ transformCombineOpsCommon S.fromFoldable "zipSerially" zipSerially (==)
743− transformCombineOpsCommon A.fromFoldable "zipAsyncly" zipAsyncly (==)
743+ transformCombineOpsCommon S.fromFoldable "zipAsyncly" zipAsyncly (==)
744− transformCombineOpsCommon A.fromFoldable "asyncly" asyncly sortEq
744+ transformCombineOpsCommon S.fromFoldable "asyncly" asyncly sortEq
745− transformCombineOpsCommon A.fromFoldable "wAsyncly" wAsyncly sortEq
745+ transformCombineOpsCommon S.fromFoldable "wAsyncly" wAsyncly sortEq
746− transformCombineOpsCommon A.fromFoldable "parallely" parallely sortEq
746+ transformCombineOpsCommon S.fromFoldable "parallely" parallely sortEq
748 transformCombineOpsCommon folded "serially" serially (==)
748 transformCombineOpsCommon folded "serially" serially (==)
749 transformCombineOpsCommon folded "aheadly" aheadly (==)
749 transformCombineOpsCommon folded "aheadly" aheadly (==)
@@ -754,20 +754,20 @@ main = hspec $ do
754 transformCombineOpsCommon folded "wAsyncly" wAsyncly sortEq
754 transformCombineOpsCommon folded "wAsyncly" wAsyncly sortEq
755 transformCombineOpsCommon folded "parallely" parallely sortEq
755 transformCombineOpsCommon folded "parallely" parallely sortEq
757− transformCombineOpsOrdered A.fromFoldable "serially" serially (==)
757+ transformCombineOpsOrdered S.fromFoldable "serially" serially (==)
758− transformCombineOpsOrdered A.fromFoldable "serially" aheadly (==)
758+ transformCombineOpsOrdered S.fromFoldable "serially" aheadly (==)
759− transformCombineOpsOrdered A.fromFoldable "zipSerially" zipSerially (==)
759+ transformCombineOpsOrdered S.fromFoldable "zipSerially" zipSerially (==)
760− transformCombineOpsOrdered A.fromFoldable "zipAsyncly" zipAsyncly (==)
760+ transformCombineOpsOrdered S.fromFoldable "zipAsyncly" zipAsyncly (==)
762 describe "Stream elimination operations" $ do
762 describe "Stream elimination operations" $ do
763− eliminationOps A.fromFoldable "serially" serially
763+ eliminationOps S.fromFoldable "serially" serially
764− eliminationOps A.fromFoldable "aheadly" aheadly
764+ eliminationOps S.fromFoldable "aheadly" aheadly
765− eliminationOps A.fromFoldable "wSerially" wSerially
765+ eliminationOps S.fromFoldable "wSerially" wSerially
766− eliminationOps A.fromFoldable "zipSerially" zipSerially
766+ eliminationOps S.fromFoldable "zipSerially" zipSerially
767− eliminationOps A.fromFoldable "zipAsyncly" zipAsyncly
767+ eliminationOps S.fromFoldable "zipAsyncly" zipAsyncly
768− eliminationOps A.fromFoldable "asyncly" asyncly
768+ eliminationOps S.fromFoldable "asyncly" asyncly
769− eliminationOps A.fromFoldable "wAsyncly" wAsyncly
769+ eliminationOps S.fromFoldable "wAsyncly" wAsyncly
770− eliminationOps A.fromFoldable "parallely" parallely
770+ eliminationOps S.fromFoldable "parallely" parallely
772 eliminationOps folded "serially folded" serially
772 eliminationOps folded "serially folded" serially
773 eliminationOps folded "aheadly folded" aheadly
773 eliminationOps folded "aheadly folded" aheadly
@@ -779,11 +779,11 @@ main = hspec $ do
779 eliminationOps folded "parallely folded" parallely
779 eliminationOps folded "parallely folded" parallely
781 describe "Stream serial elimination operations" $ do
781 describe "Stream serial elimination operations" $ do
782− serialEliminationOps A.fromFoldable "serially" serially
782+ serialEliminationOps S.fromFoldable "serially" serially
783− serialEliminationOps A.fromFoldable "aheadly" aheadly
783+ serialEliminationOps S.fromFoldable "aheadly" aheadly
784− serialEliminationOps A.fromFoldable "wSerially" wSerially
784+ serialEliminationOps S.fromFoldable "wSerially" wSerially
785− serialEliminationOps A.fromFoldable "zipSerially" zipSerially
785+ serialEliminationOps S.fromFoldable "zipSerially" zipSerially
786− serialEliminationOps A.fromFoldable "zipAsyncly" zipAsyncly
786+ serialEliminationOps S.fromFoldable "zipAsyncly" zipAsyncly
788 serialEliminationOps folded "serially folded" serially
788 serialEliminationOps folded "serially folded" serially
789 serialEliminationOps folded "aheadly folded" aheadly
789 serialEliminationOps folded "aheadly folded" aheadly