@@ -44,11 +44,12 @@ import Streamly.Prelude (SerialT, IsStream, serial, fromSerial)
44#ifndef COVERAGE_BUILD
44#ifndef COVERAGE_BUILD
45import Streamly.Prelude (avgRate, maxBuffer)
45import Streamly.Prelude (avgRate, maxBuffer)
47−import qualified Streamly.Prelude as S
47+import qualified Streamly.Data.Stream.Prelude as S
48import qualified Streamly.Internal.Data.Fold as FL
48import qualified Streamly.Internal.Data.Fold as FL
49import qualified Streamly.Internal.Data.Unfold as UF
49import qualified Streamly.Internal.Data.Unfold as UF
50−import qualified Streamly.Internal.Data.Stream.IsStream as IS
50+import qualified Streamly.Internal.Data.Stream as IS
51import qualified Streamly.Data.Array as A
51import qualified Streamly.Data.Array as A
52+import qualified Streamly.Internal.Data.Parser as Parser
53import Streamly.Internal.Data.Time.Units
54import Streamly.Internal.Data.Time.Units
54 (AbsTime, NanoSecond64(..), toRelTime64, diffAbsTime64)
55 (AbsTime, NanoSecond64(..), toRelTime64, diffAbsTime64)
@@ -59,31 +60,66 @@ import Streamly.Internal.Data.Time.Clock (Clock(Monotonic), getTime)
60import Streamly.Test.Common
61import Streamly.Test.Common
61import Streamly.Test.Prelude.Common
62import Streamly.Test.Prelude.Common
63+import Control.Monad.IO.Class (MonadIO)
65+toList :: Monad m => S.Stream m a -> m [a]
66+toList = S.fold FL.toList
69+ (a -> Bool) -> FL.Fold m a b -> S.Stream m a -> S.Stream m b
70+splitOn predicate f = IS.foldManyPost (FL.takeEndBy_ predicate f)
72+splitOnSuffix :: Monad m =>
73+ (a -> Bool) -> FL.Fold m a b -> S.Stream m a -> S.Stream m b
74+splitOnSuffix predicate f = S.foldMany (FL.takeEndBy_ predicate f)
76+splitOnSeq' :: (MonadIO m, Unbox a, Storable a, Enum a, Eq a) =>
77+ A.Array a -> FL.Fold m a b -> S.Stream m a -> S.Stream m b
78+splitOnSeq' patt f m = IS.foldManyPost (FL.takeEndBySeq_ patt f) m
80+splitOnSuffixSeq' :: (MonadIO m, Unbox a, Storable a, Enum a, Eq a) =>
81+ A.Array a -> FL.Fold m a b -> S.Stream m a -> S.Stream m b
82+splitOnSuffixSeq' patt f m = S.foldMany (FL.takeEndBySeq_ patt f) m
84+groupsBy :: Monad m =>
85+ (a -> a -> Bool) -> FL.Fold m a b -> S.Stream m a -> S.Stream m b
86+groupsBy cmp f m = S.catRights $ S.parseMany (Parser.groupBy cmp f) m
88+groupsByRolling :: Monad m =>
89+ (a -> a -> Bool) -> FL.Fold m a b -> S.Stream m a -> S.Stream m b
90+groupsByRolling cmp f m =
91+ S.catRights $ S.parseMany (Parser.groupByRolling cmp f) m
93+drainWhile :: Monad m => (a -> Bool) -> S.Stream m a -> m ()
94+drainWhile p = S.fold FL.drain . S.takeWhile p
96+drainMapM :: Monad m => (a -> m b) -> S.Stream m a -> m ()
97+drainMapM f = S.fold (FL.drainMapM f)
63splitOnSeq :: Spec
99splitOnSeq :: Spec
64splitOnSeq = do
100splitOnSeq = do
65 describe "Tests for splitOnSeq" $ do
101 describe "Tests for splitOnSeq" $ do
66− it "splitOnSeq' \"hello\" \"\" = [\"\"]"
102+ it "splitOnSeq_ \"hello\" \"\" = [\"\"]"
67− $ splitOnSeq' "hello" "" `shouldReturn` [""]
103+ $ splitOnSeq_ "hello" "" `shouldReturn` [""]
68− it "splitOnSeq' \"hello\" \"hello\" = [\"\", \"\"]"
104+ it "splitOnSeq_ \"hello\" \"hello\" = [\"\", \"\"]"
69− $ splitOnSeq' "hello" "hello" `shouldReturn` ["", ""]
105+ $ splitOnSeq_ "hello" "hello" `shouldReturn` ["", ""]
70− it "splitOnSeq' \"x\" \"hello\" = [\"hello\"]"
106+ it "splitOnSeq_ \"x\" \"hello\" = [\"hello\"]"
71− $ splitOnSeq' "x" "hello" `shouldReturn` ["hello"]
107+ $ splitOnSeq_ "x" "hello" `shouldReturn` ["hello"]
72− it "splitOnSeq' \"h\" \"hello\" = [\"\", \"ello\"]"
108+ it "splitOnSeq_ \"h\" \"hello\" = [\"\", \"ello\"]"
73− $ splitOnSeq' "h" "hello" `shouldReturn` ["", "ello"]
109+ $ splitOnSeq_ "h" "hello" `shouldReturn` ["", "ello"]
74− it "splitOnSeq' \"o\" \"hello\" = [\"hell\", \"\"]"
110+ it "splitOnSeq_ \"o\" \"hello\" = [\"hell\", \"\"]"
75− $ splitOnSeq' "o" "hello" `shouldReturn` ["hell", ""]
111+ $ splitOnSeq_ "o" "hello" `shouldReturn` ["hell", ""]
76− it "splitOnSeq' \"e\" \"hello\" = [\"h\", \"llo\"]"
112+ it "splitOnSeq_ \"e\" \"hello\" = [\"h\", \"llo\"]"
77− $ splitOnSeq' "e" "hello" `shouldReturn` ["h", "llo"]
113+ $ splitOnSeq_ "e" "hello" `shouldReturn` ["h", "llo"]
78− it "splitOnSeq' \"l\" \"hello\" = [\"he\", \"\", \"o\"]"
114+ it "splitOnSeq_ \"l\" \"hello\" = [\"he\", \"\", \"o\"]"
79− $ splitOnSeq' "l" "hello" `shouldReturn` ["he", "", "o"]
115+ $ splitOnSeq_ "l" "hello" `shouldReturn` ["he", "", "o"]
80− it "splitOnSeq' \"ll\" \"hello\" = [\"he\", \"o\"]"
116+ it "splitOnSeq_ \"ll\" \"hello\" = [\"he\", \"o\"]"
81− $ splitOnSeq' "ll" "hello" `shouldReturn` ["he", "o"]
117+ $ splitOnSeq_ "ll" "hello" `shouldReturn` ["he", "o"]
85− splitOnSeq' pat xs =
121+ splitOnSeq_ pat xs = toList $
86− S.toList $ IS.splitOnSeq (A.fromList pat) FL.toList (S.fromList xs)
122+ splitOnSeq' (A.fromList pat) FL.toList (S.fromList xs)
88splitOnSuffixSeq :: Spec
124splitOnSuffixSeq :: Spec
89splitOnSuffixSeq = do
125splitOnSuffixSeq = do
@@ -107,9 +143,8 @@ splitOnSuffixSeq = do
110− splitSuffixOn_ pat xs =
146+ splitSuffixOn_ pat xs = toList $
112− $ IS.splitOnSuffixSeq (A.fromList pat) FL.toList (S.fromList xs)
147+ splitOnSuffixSeq' (A.fromList pat) FL.toList (S.fromList xs)
114splitterProperties ::
149splitterProperties ::
115 forall a. (Arbitrary a, Eq a, Show a, Storable a, Unbox a, Enum a)
150 forall a. (Arbitrary a, Eq a, Show a, Storable a, Unbox a, Enum a)
@@ -180,16 +215,16 @@ splitterProperties sep desc = do
182 splitOnSeq_ xs ys =
217 splitOnSeq_ xs ys =
183− S.toList $ IS.splitOnSeq (A.fromList ys) FL.toList (S.fromList xs)
218+ toList $ splitOnSeq' (A.fromList ys) FL.toList (S.fromList xs)
185 splitOnSuffixSeq_ xs ys =
220 splitOnSuffixSeq_ xs ys =
186− S.toList $ IS.splitOnSuffixSeq (A.fromList ys) FL.toList (S.fromList xs)
221+ toList $ splitOnSuffixSeq' (A.fromList ys) FL.toList (S.fromList xs)
188 splitOn_ xs ys =
223 splitOn_ xs ys =
189− S.toList $ IS.splitOn (== (head ys)) FL.toList (S.fromList xs)
224+ toList $ splitOn (== (head ys)) FL.toList (S.fromList xs)
191 splitOnSuffix_ xs ys =
226 splitOnSuffix_ xs ys =
192− S.toList $ IS.splitOnSuffix (== (head ys)) FL.toList (S.fromList xs)
227+ toList $ splitOnSuffix (== (head ys)) FL.toList (S.fromList xs)
194 intercalateSuffix xs yss = intercalate xs yss ++ xs
229 intercalateSuffix xs yss = intercalate xs yss ++ xs
@@ -221,7 +256,7 @@ splitterProperties sep desc = do
221 testCase xs = do
256 testCase xs = do
222 ys <- splitter xs (replicate i sep)
257 ys <- splitter xs (replicate i sep)
224− IS.toList
259+ toList
225 $ sIntercalater UF.fromList (replicate i sep)
260 $ sIntercalater UF.fromList (replicate i sep)
226 $ IS.fromList ys
261 $ IS.fromList ys
227 let lzs = lIntercalater (replicate i sep) ys
262 let lzs = lIntercalater (replicate i sep) ys
@@ -243,7 +278,7 @@ splitterProperties sep desc = do
243 testCase xs = do
278 testCase xs = do
244 ys <- splitter xs (replicate i sep)
279 ys <- splitter xs (replicate i sep)
246− IS.toList
281+ toList
247 $ sIntercalater UF.fromList (replicate i sep)
282 $ sIntercalater UF.fromList (replicate i sep)
248 $ IS.fromList ys
283 $ IS.fromList ys
249 let lzs = lIntercalater (replicate i sep) ys
284 let lzs = lIntercalater (replicate i sep) ys
@@ -265,7 +300,7 @@ splitterProperties sep desc = do
265 let lxs = lIntercalater (replicate i sep) xss
300 let lxs = lIntercalater (replicate i sep) xss
266 lys <- splitter lxs (replicate i sep)
301 lys <- splitter lxs (replicate i sep)
269 $ sIntercalater UF.fromList (replicate i sep)
304 $ sIntercalater UF.fromList (replicate i sep)
270 $ S.fromList xss
305 $ S.fromList xss
271 sys <- splitter sxs (replicate i sep)
306 sys <- splitter sxs (replicate i sep)
@@ -286,7 +321,7 @@ splitterProperties sep desc = do
286 testCase xss = do
321 testCase xss = do
287 let lxs = lIntercalater [sep] xss
322 let lxs = lIntercalater [sep] xss
288 lys <- splitter lxs [sep]
323 lys <- splitter lxs [sep]
289− sxs <- S.toList $ sIntercalater UF.fromList [sep] $ S.fromList xss
324+ sxs <- toList $ sIntercalater UF.fromList [sep] $ S.fromList xss
290 sys <- splitter sxs [sep]
325 sys <- splitter sxs [sep]
291 listEquals (==) lys xss
326 listEquals (==) lys xss
292 listEquals (==) sys xss
327 listEquals (==) sys xss
@@ -299,7 +334,7 @@ intercalateSplitOnId x desc =
299 forAll listWithZeroes $ \xs -> do
334 forAll listWithZeroes $ \xs -> do
300 withMaxSuccess maxTestCount $
335 withMaxSuccess maxTestCount $
301 monadicIO $ do
336 monadicIO $ do
302− ys <- S.toList $ S.splitOn (== x) toListFL (S.fromList xs)
337+ ys <- toList $ splitOn (== x) toListFL (S.fromList xs)
303 listEquals (==) (intercalate [x] ys) xs
338 listEquals (==) (intercalate [x] ys) xs
@@ -320,17 +355,17 @@ groupSplitOps desc = do
320 intercalateSplitOnId (0 :: Word8) desc
355 intercalateSplitOnId (0 :: Word8) desc
323−-- After grouping (and folding) Int stream using @>@ operation,
358+-- After grouping (and folding) Int stream using @<@ operation,
324-- the first @Int@ of every @[Int]@ in the @[Int]@ stream should be the minimum.
359-- the first @Int@ of every @[Int]@ in the @[Int]@ stream should be the minimum.
325testGroupsBy :: Property
360testGroupsBy :: Property
326testGroupsBy =
361testGroupsBy =
327 forAll (choose (0, maxStreamLen)) $ \len ->
362 forAll (choose (0, maxStreamLen)) $ \len ->
328 forAll (vectorOf len (arbitrary :: Gen Int)) $ \vec -> monadicIO $ do
363 forAll (vectorOf len (arbitrary :: Gen Int)) $ \vec -> monadicIO $ do
329− r <- run $ S.all (\ls ->
364+ r <- run $ S.fold (FL.all (\ls ->
330 case ls of
365 case ls of
331 [] -> True
366 [] -> True
332− (x:_) -> x == minimum ls)
367+ (x:_) -> x == minimum ls))
333− $ S.groupsBy (>) FL.toList
368+ $ groupsBy (<) FL.toList
334 $ S.fromList vec
369 $ S.fromList vec
@@ -338,14 +373,14 @@ testGroups :: Property
338testGroups =
373testGroups =
339 forAll (choose (0, maxStreamLen)) $ \len ->
374 forAll (choose (0, maxStreamLen)) $ \len ->
340 forAll (vectorOf len (arbitrary :: Gen Int)) $ \vec -> monadicIO $ do
375 forAll (vectorOf len (arbitrary :: Gen Int)) $ \vec -> monadicIO $ do
341− r <- run $ S.toList $ S.groups FL.toList $ S.fromList vec
376+ r <- toList $ groupsBy (==) FL.toList $ S.fromList vec
342 assert $ r == group vec
377 assert $ r == group vec
344testGroupsByRolling :: Property
379testGroupsByRolling :: Property
345testGroupsByRolling =
380testGroupsByRolling =
346 forAll (choose (0, maxStreamLen)) $ \len ->
381 forAll (choose (0, maxStreamLen)) $ \len ->
347 forAll (vectorOf len (arbitrary :: Gen Int)) $ \vec -> monadicIO $ do
382 forAll (vectorOf len (arbitrary :: Gen Int)) $ \vec -> monadicIO $ do
348− r <- run $ S.toList $ S.groupsByRolling (==) FL.toList $ S.fromList vec
383+ r <- toList $ groupsByRolling (==) FL.toList $ S.fromList vec
349 assert $ r == group vec
384 assert $ r == group vec
@@ -362,7 +397,7 @@ decreasing [] = True
362decreasing xs = all (== True) $ zipWith (<=) (tail xs) xs
397decreasing xs = all (== True) $ zipWith (<=) (tail xs) xs
365−-- To check if the minimum elements (after grouping on @>@)
400+-- To check if the minimum elements (after grouping on @<@)
366-- are non-increasing (either decrease or remain the same).
401-- are non-increasing (either decrease or remain the same).
367-- Had an element been strictly greater, it would have been grouped
402-- Had an element been strictly greater, it would have been grouped
368-- with that element only.
403-- with that element only.
@@ -370,10 +405,10 @@ testGroupsBySep :: Property
370testGroupsBySep =
405testGroupsBySep =
371 forAll (choose (0, maxStreamLen)) $ \len ->
406 forAll (choose (0, maxStreamLen)) $ \len ->
372 forAll (vectorOf len (arbitrary :: Gen Int)) $ \vec -> monadicIO $ do
407 forAll (vectorOf len (arbitrary :: Gen Int)) $ \vec -> monadicIO $ do
373− a <- run $ S.toList
408+ a <- toList
374− $ S.map maybeMinimum
409+ $ fmap maybeMinimum
375− $ S.groupsBy (>) FL.toList
410+ $ groupsBy (<) FL.toList
376− $ S.fromList vec
411+ $ S.fromList vec
377 assert $ decreasing a
412 assert $ decreasing a
379groupingOps :: Spec
414groupingOps :: Spec
@@ -396,8 +431,8 @@ associativityCheck desc t = prop desc assocCheckProp
396 yStream = S.fromList ys
431 yStream = S.fromList ys
397 zStream = S.fromList zs
432 zStream = S.fromList zs
398 infixAssocstream <-
433 infixAssocstream <-
399− run $ S.toList $ t $ xStream `serial` yStream `serial` zStream
434+ run $ toList $ t $ xStream `serial` yStream `serial` zStream
400− assocStream <- run $ S.toList $ t $ xStream <> yStream <> zStream
435+ assocStream <- run $ toList $ t $ xStream <> yStream <> zStream
401 listEquals (==) infixAssocstream assocStream
436 listEquals (==) infixAssocstream assocStream
403max_length :: Int
438max_length :: Int
@@ -436,7 +471,7 @@ testTakeInterval :: IO Bool
436testTakeInterval = do
471testTakeInterval = do
438 S.fold (FL.tee FL.head FL.last)
473 S.fold (FL.tee FL.head FL.last)
439− $ IS.takeInterval takeDropTime
474+ $ S.takeInterval (toRelTime64 takeDropTime)
440 $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
475 $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
441 checkTakeDropTime r
476 checkTakeDropTime r
@@ -444,8 +479,8 @@ testDropInterval :: IO Bool
444testDropInterval = do
479testDropInterval = do
445 t0 <- getTime Monotonic
480 t0 <- getTime Monotonic
447− S.head
482+ S.fold FL.head
448− $ IS.dropInterval takeDropTime
483+ $ S.dropInterval (toRelTime64 takeDropTime)
449 $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
484 $ S.repeatM (threadDelay 1000 >> getTime Monotonic)
450 checkTakeDropTime (Just t0, mt1)
485 checkTakeDropTime (Just t0, mt1)
@@ -455,23 +490,18 @@ unfold = monadicIO $ do
455 a <- pick $ choose (0, max_length `div` 2)
490 a <- pick $ choose (0, max_length `div` 2)
456 b <- pick $ choose (0, max_length)
491 b <- pick $ choose (0, max_length)
457 let unf = UF.second b UF.enumerateFromToIntegral
492 let unf = UF.second b UF.enumerateFromToIntegral
458− ls <- S.toList $ S.unfold unf a
493+ ls <- toList $ S.unfold unf a
459− return $ ls == [a..b]
462−unfold0 = monadicIO $ do
463− a <- pick $ choose (0, max_length `div` 2)
464− b <- pick $ choose (0, max_length)
465− let unf = UF.both a (UF.second b UF.enumerateFromToIntegral)
466− ls <- S.toList $ IS.unfold0 unf
467 return $ ls == [a..b]
494 return $ ls == [a..b]
469testFromCallback :: IO Int
496testFromCallback :: IO Int
470testFromCallback = do
497testFromCallback = do
471 ref <- newIORef Nothing
498 ref <- newIORef Nothing
500+ S.parConcatList (S.eager True)
472− let stream = S.map Just (IS.fromCallback (setCallback ref))
501+ [ fmap Just (S.fromCallback (setCallback ref))
473− `S.parallel` runCallback ref
502+ , runCallback ref
474− S.sum $ S.map fromJust $ S.takeWhile isJust stream
504+ S.fold FL.sum $ fmap fromJust $ S.takeWhile isJust stream
@@ -483,11 +513,11 @@ testFromCallback = do
483 S.repeatM (readIORef ref)
513 S.repeatM (readIORef ref)
484 & IS.delayPost 0.1
514 & IS.delayPost 0.1
485 & S.mapMaybe id
515 & S.mapMaybe id
486− & S.head
516+ & S.fold FL.head
488 S.fromList [1..100]
518 S.fromList [1..100]
489 & IS.delayPost 0.001
519 & IS.delayPost 0.001
490− & S.mapM_ (fromJust cb)
520+ & drainMapM (fromJust cb)
491 threadDelay 100000
521 threadDelay 100000
492 return Nothing
522 return Nothing
@@ -497,12 +527,12 @@ foldIterateM =
497 let s1 = Prelude.sum lst
527 let s1 = Prelude.sum lst
498 strm = S.fromList lst
528 strm = S.fromList lst
500− S.last
530+ S.fold FL.last
501− $ S.map getSum
531+ $ fmap getSum
502 $ IS.foldIterateM
532 $ IS.foldIterateM
503 (return . FL.take 1 . FL.sconcat)
533 (return . FL.take 1 . FL.sconcat)
504 (return (Sum 0))
534 (return (Sum 0))
505− $ S.map Sum strm
535+ $ fmap Sum strm
506 case ms2 of
536 case ms2 of
507 Nothing -> assert $ s1 == 0
537 Nothing -> assert $ s1 == 0
508 Just s2 -> assert $ s1 == s2
538 Just s2 -> assert $ s1 == s2
@@ -510,7 +540,7 @@ foldIterateM =
510sortBy :: Property
540sortBy :: Property
511sortBy = forAll (listOf (chooseInt (0, max_length))) $ \lst -> monadicIO $ do
541sortBy = forAll (listOf (chooseInt (0, max_length))) $ \lst -> monadicIO $ do
512 let s1 = sort lst
542 let s1 = sort lst
513− s2 <- run $ S.toList $ IS.sortBy compare $ S.fromList lst
543+ s2 <- toList $ IS.sortBy compare $ S.fromList lst
514 assert $ s1 == s2
544 assert $ s1 == s2
516moduleName :: String
546moduleName :: String
@@ -530,14 +560,16 @@ main = hspec
530 <> [("maxBuffer -1", fromSerial . maxBuffer (-1))]
560 <> [("maxBuffer -1", fromSerial . maxBuffer (-1))]
532 let toListSerial :: SerialT IO a -> IO [a]
562 let toListSerial :: SerialT IO a -> IO [a]
533− toListSerial = S.toList . fromSerial
563+ toListSerial = toList . fromSerial
535 describe "Runners" $ do
565 describe "Runners" $ do
536 -- XXX use an IORef to store and check the side effects
566 -- XXX use an IORef to store and check the side effects
537 it "simple serially" $
567 it "simple serially" $
568+ (S.fold FL.drain . fromSerial)
538− (S.drain . fromSerial) (return (0 :: Int)) `shouldReturn` ()
569+ (return (0 :: Int)) `shouldReturn` ()
539 it "simple serially with IO" $
570 it "simple serially with IO" $
571+ (S.fold FL.drain . fromSerial)
540− (S.drain . fromSerial) (S.fromEffect $ putStrLn "hello") `shouldReturn` ()
572+ (S.fromEffect $ putStrLn "hello") `shouldReturn` ()
542 describe "Empty" $
574 describe "Empty" $
543 it "Monoid - mempty" $
575 it "Monoid - mempty" $
@@ -571,12 +603,9 @@ main = hspec
571 serialOps $ prop "serially fromEffect" . constructWithFromEffect id
603 serialOps $ prop "serially fromEffect" . constructWithFromEffect id
572 serialOps $ prop "serially cons" . constructWithCons S.cons
604 serialOps $ prop "serially cons" . constructWithCons S.cons
573 serialOps $ prop "serially consM" . constructWithConsM S.consM id
605 serialOps $ prop "serially consM" . constructWithConsM S.consM id
574− serialOps $ prop "serially (.:)" . constructWithCons (S..:)
575− serialOps $ prop "serially (|:)" . constructWithConsM (S.|:) id
577 describe "From Generators" $ do
607 describe "From Generators" $ do
578 prop "unfold" unfold
608 prop "unfold" unfold
579− prop "unfold0" unfold0
581 describe "Simple Operations" $ serialOps simpleOps
610 describe "Simple Operations" $ serialOps simpleOps
@@ -649,13 +678,13 @@ main = hspec
649 -- Just some basic sanity tests for now
678 -- Just some basic sanity tests for now
650 let input = [[1,1] :: [Int],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8]]
679 let input = [[1,1] :: [Int],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8]]
651 mustBe g inp out =
680 mustBe g inp out =
652− S.toList (IS.concatPairsWith g S.fromList (S.fromList inp))
681+ toList (S.mergeMapWith g S.fromList (S.fromList inp))
653 `shouldReturn` out
682 `shouldReturn` out
655 it "concatPairsWith serial"
684 it "concatPairsWith serial"
656− $ mustBe S.serial input [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8]
685+ $ mustBe S.append input [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8]
657 it "concatPairsWith wSerial"
686 it "concatPairsWith wSerial"
658− $ mustBe S.wSerial input [1,5,3,7,2,6,4,8,1,5,3,7,2,6,4,8]
687+ $ mustBe S.interleave input [1,5,3,7,2,6,4,8,1,5,3,7,2,6,4,8]
659 it "concatPairsWith mergeBy sorted"
688 it "concatPairsWith mergeBy sorted"
661 (S.mergeBy compare) input [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8]
690 (S.mergeBy compare) input [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8]
@@ -681,7 +710,7 @@ main = hspec
681 let xs = [1..n]
710 let xs = [1..n]
682 ioRef <- run $ newIORef ([] :: [Int])
711 ioRef <- run $ newIORef ([] :: [Int])
684− S.drainWhile (> 0) . t $
713+ drainWhile (> 0) . t $
685 S.mapM (\a -> modifyIORef' ioRef (a :) >> return a) $
714 S.mapM (\a -> modifyIORef' ioRef (a :) >> return a) $
686 S.fromList xs
715 S.fromList xs
687 strm <- run $ readIORef ioRef
716 strm <- run $ readIORef ioRef