@@ -20,11 +20,11 @@ import qualified Streamly.Prelude as A
20singleton :: IsStream t => a -> t m a
20singleton :: IsStream t => a -> t m a
21singleton a = a .: nil
21singleton a = a .: nil
23−toListSerial :: SerialT IO a -> IO [a]
23+toListSerial :: StreamT IO a -> IO [a]
24−toListSerial = A.toList . serially
24+toListSerial = A.toList . streamly
26−toListInterleaved :: CoserialT IO a -> IO [a]
26+toListInterleaved :: CostreamT IO a -> IO [a]
27−toListInterleaved = A.toList . coserially
27+toListInterleaved = A.toList . costreamly
29toListAsync :: CoparallelT IO a -> IO [a]
29toListAsync :: CoparallelT IO a -> IO [a]
30toListAsync = A.toList . coparallely
30toListAsync = A.toList . coparallely
@@ -37,10 +37,10 @@ main = hspec $ do
37 describe "Runners" $ do
37 describe "Runners" $ do
38 -- XXX move these to property tests
38 -- XXX move these to property tests
39 -- XXX use an IORef to store and check the side effects
39 -- XXX use an IORef to store and check the side effects
40− it "simple serially" $
40+ it "simple streamly" $
41− (runStream . serially) (return (0 :: Int)) `shouldReturn` ()
41+ (runStream . streamly) (return (0 :: Int)) `shouldReturn` ()
42− it "simple serially with IO" $
42+ it "simple streamly with IO" $
43− (runStream . serially) (liftIO $ putStrLn "hello") `shouldReturn` ()
43+ (runStream . streamly) (liftIO $ putStrLn "hello") `shouldReturn` ()
45 describe "Empty" $ do
45 describe "Empty" $ do
46 it "Monoid - mempty" $
46 it "Monoid - mempty" $
@@ -96,8 +96,8 @@ main = hspec $ do
96 -- for Monoid that is using the right version of semigroup. Instance
96 -- for Monoid that is using the right version of semigroup. Instance
97 -- deriving can cause us to pick wrong instances sometimes.
97 -- deriving can cause us to pick wrong instances sometimes.
99− describe "Serial interleaved (<>) ordering check" $ interleaveCheck coserially (<>)
99+ describe "Serial interleaved (<>) ordering check" $ interleaveCheck costreamly (<>)
100− describe "Serial interleaved mappend ordering check" $ interleaveCheck coserially mappend
100+ describe "Serial interleaved mappend ordering check" $ interleaveCheck costreamly mappend
102 describe "Parallel interleaved (<>) ordering check" $ interleaveCheck parallely (<>)
102 describe "Parallel interleaved (<>) ordering check" $ interleaveCheck parallely (<>)
103 describe "Parallel interleaved mappend ordering check" $ interleaveCheck parallely mappend
103 describe "Parallel interleaved mappend ordering check" $ interleaveCheck parallely mappend
@@ -111,11 +111,11 @@ main = hspec $ do
111 -- Monoidal Compositions, multiset equality checks
111 -- Monoidal Compositions, multiset equality checks
112 ---------------------------------------------------------------------------
112 ---------------------------------------------------------------------------
114− describe "Serial Composition" $ compose serially mempty id
114+ describe "Serial Composition" $ compose streamly mempty id
115− describe "Interleaved Composition" $ compose coserially mempty sort
115+ describe "Interleaved Composition" $ compose costreamly mempty sort
116 describe "Left biased parallel Composition" $ compose coparallely mempty sort
116 describe "Left biased parallel Composition" $ compose coparallely mempty sort
117 describe "Fair parallel Composition" $ compose parallely mempty sort
117 describe "Fair parallel Composition" $ compose parallely mempty sort
118− describe "Semigroup Composition for ZipSerial" $ compose zipSerially mempty id
118+ describe "Semigroup Composition for ZipSerial" $ compose zipStreamly mempty id
119 describe "Semigroup Composition for ZipAsync" $ compose zipParallely mempty id
119 describe "Semigroup Composition for ZipAsync" $ compose zipParallely mempty id
120 -- XXX need to check alternative compositions as well
120 -- XXX need to check alternative compositions as well
@@ -124,11 +124,11 @@ main = hspec $ do
124 ---------------------------------------------------------------------------
124 ---------------------------------------------------------------------------
126 -- TBD need more such combinations to be tested.
126 -- TBD need more such combinations to be tested.
127− describe "<> and <>" $ composeAndComposeSimple serially serially (cycle [[1 .. 9]])
127+ describe "<> and <>" $ composeAndComposeSimple streamly streamly (cycle [[1 .. 9]])
129 describe "<> and <=>" $ composeAndComposeSimple
129 describe "<> and <=>" $ composeAndComposeSimple
130− serially
130+ streamly
131− coserially
131+ costreamly
132 ([ [1 .. 9]
132 ([ [1 .. 9]
133 , [1 .. 9]
133 , [1 .. 9]
134 , [1, 3, 2, 4, 6, 5, 7, 9, 8]
134 , [1, 3, 2, 4, 6, 5, 7, 9, 8]
@@ -136,8 +136,8 @@ main = hspec $ do
138 describe "<=> and <=>" $ composeAndComposeSimple
138 describe "<=> and <=>" $ composeAndComposeSimple
139− coserially
139+ costreamly
140− coserially
140+ costreamly
141 ([ [1, 4, 2, 7, 3, 5, 8, 6, 9]
141 ([ [1, 4, 2, 7, 3, 5, 8, 6, 9]
142 , [1, 7, 4, 8, 2, 9, 5, 3, 6]
142 , [1, 7, 4, 8, 2, 9, 5, 3, 6]
143 , [1, 4, 3, 7, 2, 6, 9, 5, 8]
143 , [1, 4, 3, 7, 2, 6, 9, 5, 8]
@@ -145,8 +145,8 @@ main = hspec $ do
147 describe "<=> and <>" $ composeAndComposeSimple
147 describe "<=> and <>" $ composeAndComposeSimple
148− coserially
148+ costreamly
149− serially
149+ streamly
150 ([ [1, 4, 2, 7, 3, 5, 8, 6, 9]
150 ([ [1, 4, 2, 7, 3, 5, 8, 6, 9]
151 , [1, 7, 4, 8, 2, 9, 5, 3, 6]
151 , [1, 7, 4, 8, 2, 9, 5, 3, 6]
152 , [1, 4, 2, 7, 3, 5, 8, 6, 9]
152 , [1, 4, 2, 7, 3, 5, 8, 6, 9]
@@ -156,7 +156,7 @@ main = hspec $ do
156 describe "Nested parallel and serial compositions" $ do
156 describe "Nested parallel and serial compositions" $ do
157 let t = timed
157 let t = timed
158 p = parallely
158 p = parallely
159− s = serially
159+ s = streamly
161 -- This is not correct, the result can also be [4,4,8,0,8,0,2,2]
161 -- This is not correct, the result can also be [4,4,8,0,8,0,2,2]
162 -- because of parallelism of [8,0] and [8,0].
162 -- because of parallelism of [8,0] and [8,0].
@@ -198,7 +198,7 @@ main = hspec $ do
198 -- Monoidal composition recursion loops
198 -- Monoidal composition recursion loops
199 ---------------------------------------------------------------------------
199 ---------------------------------------------------------------------------
201− describe "Serial loops (<>)" $ loops serially id reverse
201+ describe "Serial loops (<>)" $ loops streamly id reverse
202 describe "Left biased parallel loops (<|)" $ loops coparallely sort sort
202 describe "Left biased parallel loops (<|)" $ loops coparallely sort sort
203 describe "Fair parallel loops (<|>)" $ loops parallely sort sort
203 describe "Fair parallel loops (<|>)" $ loops parallely sort sort
@@ -206,23 +206,23 @@ main = hspec $ do
206 -- Bind and monoidal composition combinations
206 -- Bind and monoidal composition combinations
207 ---------------------------------------------------------------------------
207 ---------------------------------------------------------------------------
209− describe "Bind and compose1" $ bindAndComposeSimple serially serially
209+ describe "Bind and compose1" $ bindAndComposeSimple streamly streamly
210− describe "Bind and compose2" $ bindAndComposeSimple serially coserially
210+ describe "Bind and compose2" $ bindAndComposeSimple streamly costreamly
211− describe "Bind and compose3" $ bindAndComposeSimple serially coparallely
211+ describe "Bind and compose3" $ bindAndComposeSimple streamly coparallely
212− describe "Bind and compose4" $ bindAndComposeSimple serially parallely
212+ describe "Bind and compose4" $ bindAndComposeSimple streamly parallely
214− describe "Bind and compose1" $ bindAndComposeSimple coserially serially
214+ describe "Bind and compose1" $ bindAndComposeSimple costreamly streamly
215− describe "Bind and compose2" $ bindAndComposeSimple coserially coserially
215+ describe "Bind and compose2" $ bindAndComposeSimple costreamly costreamly
216− describe "Bind and compose3" $ bindAndComposeSimple coserially coparallely
216+ describe "Bind and compose3" $ bindAndComposeSimple costreamly coparallely
217− describe "Bind and compose4" $ bindAndComposeSimple coserially parallely
217+ describe "Bind and compose4" $ bindAndComposeSimple costreamly parallely
219− describe "Bind and compose1" $ bindAndComposeSimple coparallely serially
219+ describe "Bind and compose1" $ bindAndComposeSimple coparallely streamly
220− describe "Bind and compose2" $ bindAndComposeSimple coparallely coserially
220+ describe "Bind and compose2" $ bindAndComposeSimple coparallely costreamly
221 describe "Bind and compose3" $ bindAndComposeSimple coparallely coparallely
221 describe "Bind and compose3" $ bindAndComposeSimple coparallely coparallely
222 describe "Bind and compose4" $ bindAndComposeSimple coparallely parallely
222 describe "Bind and compose4" $ bindAndComposeSimple coparallely parallely
224− describe "Bind and compose1" $ bindAndComposeSimple parallely serially
224+ describe "Bind and compose1" $ bindAndComposeSimple parallely streamly
225− describe "Bind and compose2" $ bindAndComposeSimple parallely coserially
225+ describe "Bind and compose2" $ bindAndComposeSimple parallely costreamly
226 describe "Bind and compose3" $ bindAndComposeSimple parallely coparallely
226 describe "Bind and compose3" $ bindAndComposeSimple parallely coparallely
227 describe "Bind and compose4" $ bindAndComposeSimple parallely parallely
227 describe "Bind and compose4" $ bindAndComposeSimple parallely parallely
@@ -231,36 +231,36 @@ main = hspec $ do
231 fldl = foldl (<>) nil
231 fldl = foldl (<>) nil
233 forM_ [fldr, fldl] $ \k ->
233 forM_ [fldr, fldl] $ \k ->
234− describe "Bind and compose" $ bindAndComposeHierarchy serially serially k
234+ describe "Bind and compose" $ bindAndComposeHierarchy streamly streamly k
235 forM_ [fldr, fldl] $ \k ->
235 forM_ [fldr, fldl] $ \k ->
236− describe "Bind and compose" $ bindAndComposeHierarchy serially coserially k
236+ describe "Bind and compose" $ bindAndComposeHierarchy streamly costreamly k
237 forM_ [fldr, fldl] $ \k ->
237 forM_ [fldr, fldl] $ \k ->
238− describe "Bind and compose" $ bindAndComposeHierarchy serially coparallely k
238+ describe "Bind and compose" $ bindAndComposeHierarchy streamly coparallely k
239 forM_ [fldr, fldl] $ \k ->
239 forM_ [fldr, fldl] $ \k ->
240− describe "Bind and compose" $ bindAndComposeHierarchy serially parallely k
240+ describe "Bind and compose" $ bindAndComposeHierarchy streamly parallely k
242 forM_ [fldr, fldl] $ \k ->
242 forM_ [fldr, fldl] $ \k ->
243− describe "Bind and compose" $ bindAndComposeHierarchy coserially serially k
243+ describe "Bind and compose" $ bindAndComposeHierarchy costreamly streamly k
244 forM_ [fldr, fldl] $ \k ->
244 forM_ [fldr, fldl] $ \k ->
245− describe "Bind and compose" $ bindAndComposeHierarchy coserially coserially k
245+ describe "Bind and compose" $ bindAndComposeHierarchy costreamly costreamly k
246 forM_ [fldr, fldl] $ \k ->
246 forM_ [fldr, fldl] $ \k ->
247− describe "Bind and compose" $ bindAndComposeHierarchy coserially coparallely k
247+ describe "Bind and compose" $ bindAndComposeHierarchy costreamly coparallely k
248 forM_ [fldr, fldl] $ \k ->
248 forM_ [fldr, fldl] $ \k ->
249− describe "Bind and compose" $ bindAndComposeHierarchy coserially parallely k
249+ describe "Bind and compose" $ bindAndComposeHierarchy costreamly parallely k
251 forM_ [fldr, fldl] $ \k ->
251 forM_ [fldr, fldl] $ \k ->
252− describe "Bind and compose" $ bindAndComposeHierarchy coparallely serially k
252+ describe "Bind and compose" $ bindAndComposeHierarchy coparallely streamly k
253 forM_ [fldr, fldl] $ \k ->
253 forM_ [fldr, fldl] $ \k ->
254− describe "Bind and compose" $ bindAndComposeHierarchy coparallely coserially k
254+ describe "Bind and compose" $ bindAndComposeHierarchy coparallely costreamly k
255 forM_ [fldr, fldl] $ \k ->
255 forM_ [fldr, fldl] $ \k ->
256 describe "Bind and compose" $ bindAndComposeHierarchy coparallely coparallely k
256 describe "Bind and compose" $ bindAndComposeHierarchy coparallely coparallely k
257 forM_ [fldr, fldl] $ \k ->
257 forM_ [fldr, fldl] $ \k ->
258 describe "Bind and compose" $ bindAndComposeHierarchy coparallely parallely k
258 describe "Bind and compose" $ bindAndComposeHierarchy coparallely parallely k
260 forM_ [fldr, fldl] $ \k ->
260 forM_ [fldr, fldl] $ \k ->
261− describe "Bind and compose" $ bindAndComposeHierarchy parallely serially k
261+ describe "Bind and compose" $ bindAndComposeHierarchy parallely streamly k
262 forM_ [fldr, fldl] $ \k ->
262 forM_ [fldr, fldl] $ \k ->
263− describe "Bind and compose" $ bindAndComposeHierarchy parallely coserially k
263+ describe "Bind and compose" $ bindAndComposeHierarchy parallely costreamly k
264 forM_ [fldr, fldl] $ \k ->
264 forM_ [fldr, fldl] $ \k ->
265 describe "Bind and compose" $ bindAndComposeHierarchy parallely coparallely k
265 describe "Bind and compose" $ bindAndComposeHierarchy parallely coparallely k
266 forM_ [fldr, fldl] $ \k ->
266 forM_ [fldr, fldl] $ \k ->
@@ -286,14 +286,14 @@ main = hspec $ do
286 describe "Simple MonadError and MonadThrow" simpleMonadError
286 describe "Simple MonadError and MonadThrow" simpleMonadError
289− describe "Composed MonadError serially" $ composeWithMonadError serially
289+ describe "Composed MonadError streamly" $ composeWithMonadError streamly
290− describe "Composed MonadError coserially" $ composeWithMonadError coserially
290+ describe "Composed MonadError costreamly" $ composeWithMonadError costreamly
291 describe "Composed MonadError coparallely" $ composeWithMonadError coparallely
291 describe "Composed MonadError coparallely" $ composeWithMonadError coparallely
292 describe "Composed MonadError parallely" $ composeWithMonadError parallely
292 describe "Composed MonadError parallely" $ composeWithMonadError parallely
295− describe "Composed MonadThrow serially" $ composeWithMonadThrow serially
295+ describe "Composed MonadThrow streamly" $ composeWithMonadThrow streamly
296− describe "Composed MonadThrow coserially" $ composeWithMonadThrow coserially
296+ describe "Composed MonadThrow costreamly" $ composeWithMonadThrow costreamly
297 describe "Composed MonadThrow coparallely" $ composeWithMonadThrow coparallely
297 describe "Composed MonadThrow coparallely" $ composeWithMonadThrow coparallely
298 describe "Composed MonadThrow parallely" $ composeWithMonadThrow parallely
298 describe "Composed MonadThrow parallely" $ composeWithMonadThrow parallely
@@ -326,7 +326,7 @@ composeWithMonadThrow
326 , Semigroup (t IO Int)
326 , Semigroup (t IO Int)
327 , MonadThrow (t IO)
327 , MonadThrow (t IO)
329− => (t IO Int -> SerialT IO Int) -> Spec
329+ => (t IO Int -> StreamT IO Int) -> Spec
330composeWithMonadThrow t = do
330composeWithMonadThrow t = do
331 it "Compose throwM, nil" $
331 it "Compose throwM, nil" $
332 (try $ tl (throwM (ExampleException "E") <> A.nil))
332 (try $ tl (throwM (ExampleException "E") <> A.nil))
@@ -334,14 +334,14 @@ composeWithMonadThrow t = do
334 it "Compose nil, throwM" $
334 it "Compose nil, throwM" $
335 (try $ tl (A.nil <> throwM (ExampleException "E")))
335 (try $ tl (A.nil <> throwM (ExampleException "E")))
336 `shouldReturn` (Left (ExampleException "E") :: Either ExampleException [Int])
336 `shouldReturn` (Left (ExampleException "E") :: Either ExampleException [Int])
337− oneLevelNestedSum "serially" serially
337+ oneLevelNestedSum "streamly" streamly
338− oneLevelNestedSum "coserially" coserially
338+ oneLevelNestedSum "costreamly" costreamly
339 oneLevelNestedSum "coparallely" coparallely
339 oneLevelNestedSum "coparallely" coparallely
340 oneLevelNestedSum "parallely" parallely
340 oneLevelNestedSum "parallely" parallely
341 -- XXX add two level nesting
341 -- XXX add two level nesting
343− oneLevelNestedProduct "serially" serially
343+ oneLevelNestedProduct "streamly" streamly
344− oneLevelNestedProduct "coserially" coserially
344+ oneLevelNestedProduct "costreamly" costreamly
345 oneLevelNestedProduct "coparallely" coparallely
345 oneLevelNestedProduct "coparallely" coparallely
346 oneLevelNestedProduct "parallely" parallely
346 oneLevelNestedProduct "parallely" parallely
@@ -372,7 +372,7 @@ _composeWithMonadError
372 , Semigroup (t (ExceptT String IO) Int)
372 , Semigroup (t (ExceptT String IO) Int)
373 , MonadError String (t (ExceptT String IO))
373 , MonadError String (t (ExceptT String IO))
375− => (t (ExceptT String IO) Int -> SerialT (ExceptT String IO) Int) -> Spec
375+ => (t (ExceptT String IO) Int -> StreamT (ExceptT String IO) Int) -> Spec
376_composeWithMonadError t = do
376_composeWithMonadError t = do
377 let tl = A.toList . t
377 let tl = A.toList . t
378 it "Compose throwError, nil" $
378 it "Compose throwError, nil" $
@@ -454,7 +454,7 @@ timed :: MonadIO (t IO) => Int -> t IO Int
454timed x = liftIO (threadDelay (x * 100000)) >> return x
454timed x = liftIO (threadDelay (x * 100000)) >> return x
456interleaveCheck :: IsStream t
456interleaveCheck :: IsStream t
457− => (t IO Int -> SerialT IO Int)
457+ => (t IO Int -> StreamT IO Int)
458 -> (t IO Int -> t IO Int -> t IO Int)
458 -> (t IO Int -> t IO Int -> t IO Int)
460interleaveCheck t f =
460interleaveCheck t f =
@@ -463,7 +463,7 @@ interleaveCheck t f =
463 `shouldReturn` ([0, 100, 1, 101])
463 `shouldReturn` ([0, 100, 1, 101])
465parallelCheck :: MonadIO (t IO)
465parallelCheck :: MonadIO (t IO)
466− => (t IO Int -> SerialT IO Int)
466+ => (t IO Int -> StreamT IO Int)
467 -> (t IO Int -> t IO Int -> t IO Int)
467 -> (t IO Int -> t IO Int -> t IO Int)
469parallelCheck t f = do
469parallelCheck t f = do
@@ -478,7 +478,7 @@ parallelCheck t f = do
478 where event n = (liftIO $ threadDelay (n * 100000)) >> (return n)
478 where event n = (liftIO $ threadDelay (n * 100000)) >> (return n)
480compose :: (IsStream t, Semigroup (t IO Int))
480compose :: (IsStream t, Semigroup (t IO Int))
481− => (t IO Int -> SerialT IO Int) -> t IO Int -> ([Int] -> [Int]) -> Spec
481+ => (t IO Int -> StreamT IO Int) -> t IO Int -> ([Int] -> [Int]) -> Spec
482compose t z srt = do
482compose t z srt = do
483 -- XXX these should get covered by the property tests
483 -- XXX these should get covered by the property tests
484 it "Compose mempty, mempty" $
484 it "Compose mempty, mempty" $
@@ -517,7 +517,7 @@ composeAndComposeSimple
517 , Semigroup (t2 IO Int)
517 , Semigroup (t2 IO Int)
520− => (t1 IO Int -> SerialT IO Int)
520+ => (t1 IO Int -> StreamT IO Int)
521 -> (t2 IO Int -> t2 IO Int)
521 -> (t2 IO Int -> t2 IO Int)
522 -> [[Int]] -> Spec
522 -> [[Int]] -> Spec
523composeAndComposeSimple t1 t2 answer = do
523composeAndComposeSimple t1 t2 answer = do
@@ -565,7 +565,7 @@ loops t tsrt hsrt = do
566bindAndComposeSimple
566bindAndComposeSimple
567 :: ( IsStream t1, IsStream t2, Semigroup (t2 IO Int), Monad (t2 IO))
567 :: ( IsStream t1, IsStream t2, Semigroup (t2 IO Int), Monad (t2 IO))
568− => (t1 IO Int -> SerialT IO Int)
568+ => (t1 IO Int -> StreamT IO Int)
569 -> (t2 IO Int -> t2 IO Int)
569 -> (t2 IO Int -> t2 IO Int)
571bindAndComposeSimple t1 t2 = do
571bindAndComposeSimple t1 t2 = do
@@ -582,7 +582,7 @@ bindAndComposeSimple t1 t2 = do
582bindAndComposeHierarchy
582bindAndComposeHierarchy
583 :: ( IsStream t1, Monad (t1 IO)
583 :: ( IsStream t1, Monad (t1 IO)
584 , IsStream t2, Monad (t2 IO))
584 , IsStream t2, Monad (t2 IO))
585− => (t1 IO Int -> SerialT IO Int)
585+ => (t1 IO Int -> StreamT IO Int)
586 -> (t2 IO Int -> t2 IO Int)
586 -> (t2 IO Int -> t2 IO Int)
587 -> ([t2 IO Int] -> t2 IO Int)
587 -> ([t2 IO Int] -> t2 IO Int)
@@ -626,7 +626,7 @@ mixedOps = do
626 ] :: [Int])
626 ] :: [Int])
629− composeMixed :: SerialT IO Int
629+ composeMixed :: StreamT IO Int
630 composeMixed = do
630 composeMixed = do
631 liftIO $ return ()
631 liftIO $ return ()
632 liftIO $ putStr ""
632 liftIO $ putStr ""
@@ -640,7 +640,7 @@ mixedOps = do
641 x11 <- return 1 <> return 2
641 x11 <- return 1 <> return 2
642 y11 <- coparallely $ return 1 <> return 2
642 y11 <- coparallely $ return 1 <> return 2
643− z11 <- coserially $ return 1 <> return 2
643+ z11 <- costreamly $ return 1 <> return 2
644 liftIO $ return ()
644 liftIO $ return ()
645 liftIO $ putStr ""
645 liftIO $ putStr ""
646 return (x11 + y11 + z11)
646 return (x11 + y11 + z11)