@@ -20,27 +20,27 @@ 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 :: StreamT IO a -> IO [a]
23+toListSerial :: SerialT IO a -> IO [a]
24−toListSerial = A.toList . asStream
24+toListSerial = A.toList . serially
26−toListInterleaved :: CostreamT IO a -> IO [a]
26+toListInterleaved :: WSerialT IO a -> IO [a]
27−toListInterleaved = A.toList . asCostream
27+toListInterleaved = A.toList . wSerially
29−toListAsync :: ParAheadT IO a -> IO [a]
29+toListAsync :: AsyncT IO a -> IO [a]
30−toListAsync = A.toList . asParAhead
30+toListAsync = A.toList . asyncly
32−toListParallel :: CoparAheadT IO a -> IO [a]
32+toListParallel :: WAsyncT IO a -> IO [a]
33−toListParallel = A.toList . asCoparAhead
33+toListParallel = A.toList . wAsyncly
35main :: IO ()
35main :: IO ()
36main = hspec $ do
36main = 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 asStream" $
40+ it "simple serially" $
41− (runStream . asStream) (return (0 :: Int)) `shouldReturn` ()
41+ (runStream . serially) (return (0 :: Int)) `shouldReturn` ()
42− it "simple asStream with IO" $
42+ it "simple serially with IO" $
43− (runStream . asStream) (A.once $ putStrLn "hello") `shouldReturn` ()
43+ (runStream . serially) (A.once $ putStrLn "hello") `shouldReturn` ()
45 describe "Empty" $ do
45 describe "Empty" $ do
46 it "Monoid - mempty" $
46 it "Monoid - mempty" $
@@ -96,31 +96,31 @@ 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 asCostream (<>)
99+ describe "Serial interleaved (<>) ordering check" $ interleaveCheck wSerially (<>)
100− describe "Serial interleaved mappend ordering check" $ interleaveCheck asCostream mappend
100+ describe "Serial interleaved mappend ordering check" $ interleaveCheck wSerially mappend
102− describe "Parallel interleaved (<>) ordering check" $ interleaveCheck asCoparAhead (<>)
102+ describe "Parallel interleaved (<>) ordering check" $ interleaveCheck wAsyncly (<>)
103− describe "Parallel interleaved mappend ordering check" $ interleaveCheck asCoparAhead mappend
103+ describe "Parallel interleaved mappend ordering check" $ interleaveCheck wAsyncly mappend
105− -- describe "Parallel (<>) ordering check" $ interleaveCheck asParallel (<>)
105+ -- describe "Parallel (<>) ordering check" $ interleaveCheck parallely (<>)
106− -- describe "Parallel mappend ordering check" $ interleaveCheck asParallel mappend
106+ -- describe "Parallel mappend ordering check" $ interleaveCheck parallely mappend
108− describe "ParAhead (<>) time order check" $ parallelCheck asParAhead (<>)
108+ describe "ParAhead (<>) time order check" $ parallelCheck asyncly (<>)
109− describe "ParAhead mappend time order check" $ parallelCheck asParAhead mappend
109+ describe "ParAhead mappend time order check" $ parallelCheck asyncly mappend
110− describe "CoparAhead (<>) time order check" $ parallelCheck asCoparAhead (<>)
110+ describe "CoparAhead (<>) time order check" $ parallelCheck wAsyncly (<>)
111− describe "CoparAhead mappend time order check" $ parallelCheck asCoparAhead mappend
111+ describe "CoparAhead mappend time order check" $ parallelCheck wAsyncly mappend
113 ---------------------------------------------------------------------------
113 ---------------------------------------------------------------------------
114 -- Monoidal Compositions, multiset equality checks
114 -- Monoidal Compositions, multiset equality checks
115 ---------------------------------------------------------------------------
115 ---------------------------------------------------------------------------
117− describe "Serial Composition" $ compose asStream mempty id
117+ describe "Serial Composition" $ compose serially mempty id
118− describe "Interleaved Composition" $ compose asCostream mempty sort
118+ describe "Interleaved Composition" $ compose wSerially mempty sort
119− describe "ParAhead Composition" $ compose asParAhead mempty sort
119+ describe "ParAhead Composition" $ compose asyncly mempty sort
120− describe "CoparAhead Composition" $ compose asCoparAhead mempty sort
120+ describe "CoparAhead Composition" $ compose wAsyncly mempty sort
121− describe "Parallel Composition" $ compose asParallel mempty sort
121+ describe "Parallel Composition" $ compose parallely mempty sort
122− describe "Semigroup Composition for ZipSerial" $ compose asZipStream mempty id
122+ describe "Semigroup Composition for ZipSerial" $ compose zipSerially mempty id
123− describe "Semigroup Composition for ZipAsync" $ compose asZipParallel mempty id
123+ describe "Semigroup Composition for ZipAsync" $ compose zipAsyncly mempty id
124 -- XXX need to check alternative compositions as well
124 -- XXX need to check alternative compositions as well
126 ---------------------------------------------------------------------------
126 ---------------------------------------------------------------------------
@@ -128,11 +128,11 @@ main = hspec $ do
128 ---------------------------------------------------------------------------
128 ---------------------------------------------------------------------------
130 -- TBD need more such combinations to be tested.
130 -- TBD need more such combinations to be tested.
131− describe "<> and <>" $ composeAndComposeSimple asStream asStream (cycle [[1 .. 9]])
131+ describe "<> and <>" $ composeAndComposeSimple serially serially (cycle [[1 .. 9]])
133 describe "<> and <=>" $ composeAndComposeSimple
133 describe "<> and <=>" $ composeAndComposeSimple
134− asStream
134+ serially
135− asCostream
135+ wSerially
136 ([ [1 .. 9]
136 ([ [1 .. 9]
137 , [1 .. 9]
137 , [1 .. 9]
138 , [1, 3, 2, 4, 6, 5, 7, 9, 8]
138 , [1, 3, 2, 4, 6, 5, 7, 9, 8]
@@ -140,8 +140,8 @@ main = hspec $ do
142 describe "<=> and <=>" $ composeAndComposeSimple
142 describe "<=> and <=>" $ composeAndComposeSimple
143− asCostream
143+ wSerially
144− asCostream
144+ wSerially
145 ([ [1, 4, 2, 7, 3, 5, 8, 6, 9]
145 ([ [1, 4, 2, 7, 3, 5, 8, 6, 9]
146 , [1, 7, 4, 8, 2, 9, 5, 3, 6]
146 , [1, 7, 4, 8, 2, 9, 5, 3, 6]
147 , [1, 4, 3, 7, 2, 6, 9, 5, 8]
147 , [1, 4, 3, 7, 2, 6, 9, 5, 8]
@@ -149,8 +149,8 @@ main = hspec $ do
151 describe "<=> and <>" $ composeAndComposeSimple
151 describe "<=> and <>" $ composeAndComposeSimple
152− asCostream
152+ wSerially
153− asStream
153+ serially
154 ([ [1, 4, 2, 7, 3, 5, 8, 6, 9]
154 ([ [1, 4, 2, 7, 3, 5, 8, 6, 9]
155 , [1, 7, 4, 8, 2, 9, 5, 3, 6]
155 , [1, 7, 4, 8, 2, 9, 5, 3, 6]
156 , [1, 4, 2, 7, 3, 5, 8, 6, 9]
156 , [1, 4, 2, 7, 3, 5, 8, 6, 9]
@@ -159,8 +159,8 @@ main = hspec $ do
160 describe "Nested parallel and serial compositions" $ do
160 describe "Nested parallel and serial compositions" $ do
161 let t = timed
161 let t = timed
162− p = asCoparAhead
162+ p = wAsyncly
163− s = asStream
163+ s = serially
165 -- This is not correct, the result can also be [4,4,8,0,8,0,2,2]
165 -- This is not correct, the result can also be [4,4,8,0,8,0,2,2]
166 -- because of parallelism of [8,0] and [8,0].
166 -- because of parallelism of [8,0] and [8,0].
@@ -172,7 +172,7 @@ main = hspec $ do
172 `shouldReturn` ([4,4,8,8,0,0,2,2])
172 `shouldReturn` ([4,4,8,8,0,0,2,2])
174 it "Nest <|>, <>, <|> (2)" $
174 it "Nest <|>, <>, <|> (2)" $
175− (A.toList . asCoparAhead) (
175+ (A.toList . wAsyncly) (
176 s (p (t 4 <> t 8) <> p (t 1 <> t 2))
176 s (p (t 4 <> t 8) <> p (t 1 <> t 2))
177 <> s (p (t 4 <> t 8) <> p (t 1 <> t 2)))
177 <> s (p (t 4 <> t 8) <> p (t 1 <> t 2)))
178 `shouldReturn` ([4,4,8,8,1,1,2,2])
178 `shouldReturn` ([4,4,8,8,1,1,2,2])
@@ -193,7 +193,7 @@ main = hspec $ do
193 `shouldReturn` ([4,4,1,1,8,2,9,2])
193 `shouldReturn` ([4,4,1,1,8,2,9,2])
195 it "Nest <|>, <|>, <|>" $
195 it "Nest <|>, <|>, <|>" $
196− (A.toList . asCoparAhead) (
196+ (A.toList . wAsyncly) (
197 ((t 4 <> t 8) <> (t 0 <> t 2))
197 ((t 4 <> t 8) <> (t 0 <> t 2))
198 <> ((t 4 <> t 8) <> (t 0 <> t 2)))
198 <> ((t 4 <> t 8) <> (t 0 <> t 2)))
199 `shouldReturn` ([0,0,2,2,4,4,8,8])
199 `shouldReturn` ([0,0,2,2,4,4,8,8])
@@ -202,103 +202,103 @@ main = hspec $ do
202 -- Monoidal composition recursion loops
202 -- Monoidal composition recursion loops
203 ---------------------------------------------------------------------------
203 ---------------------------------------------------------------------------
205− describe "Serial loops" $ loops asStream id reverse
205+ describe "Serial loops" $ loops serially id reverse
206− describe "ParAhead parallel loops" $ loops asParAhead sort sort
206+ describe "ParAhead parallel loops" $ loops asyncly sort sort
207− describe "coparAhead loops" $ loops asCoparAhead sort sort
207+ describe "coparAhead loops" $ loops wAsyncly sort sort
208− describe "parallel loops" $ loops asParallel sort sort
208+ describe "parallel loops" $ loops parallely sort sort
210 ---------------------------------------------------------------------------
210 ---------------------------------------------------------------------------
211 -- Bind and monoidal composition combinations
211 -- Bind and monoidal composition combinations
212 ---------------------------------------------------------------------------
212 ---------------------------------------------------------------------------
214− describe "Bind and compose Stream 1" $ bindAndComposeSimple asStream asStream
214+ describe "Bind and compose Stream 1" $ bindAndComposeSimple serially serially
215− describe "Bind and compose Stream 2" $ bindAndComposeSimple asStream asCostream
215+ describe "Bind and compose Stream 2" $ bindAndComposeSimple serially wSerially
216− describe "Bind and compose Stream 3" $ bindAndComposeSimple asStream asParAhead
216+ describe "Bind and compose Stream 3" $ bindAndComposeSimple serially asyncly
217− describe "Bind and compose Stream 4" $ bindAndComposeSimple asStream asCoparAhead
217+ describe "Bind and compose Stream 4" $ bindAndComposeSimple serially wAsyncly
218− describe "Bind and compose Stream 5" $ bindAndComposeSimple asStream asParallel
218+ describe "Bind and compose Stream 5" $ bindAndComposeSimple serially parallely
220− describe "Bind and compose Costream 1" $ bindAndComposeSimple asCostream asStream
220+ describe "Bind and compose Costream 1" $ bindAndComposeSimple wSerially serially
221− describe "Bind and compose Costream 2" $ bindAndComposeSimple asCostream asCostream
221+ describe "Bind and compose Costream 2" $ bindAndComposeSimple wSerially wSerially
222− describe "Bind and compose Costream 3" $ bindAndComposeSimple asCostream asParAhead
222+ describe "Bind and compose Costream 3" $ bindAndComposeSimple wSerially asyncly
223− describe "Bind and compose Costream 4" $ bindAndComposeSimple asCostream asCoparAhead
223+ describe "Bind and compose Costream 4" $ bindAndComposeSimple wSerially wAsyncly
224− describe "Bind and compose Costream 5" $ bindAndComposeSimple asCostream asParallel
224+ describe "Bind and compose Costream 5" $ bindAndComposeSimple wSerially parallely
226− describe "Bind and compose ParAhead 1" $ bindAndComposeSimple asParAhead asStream
226+ describe "Bind and compose ParAhead 1" $ bindAndComposeSimple asyncly serially
227− describe "Bind and compose ParAhead 2" $ bindAndComposeSimple asParAhead asCostream
227+ describe "Bind and compose ParAhead 2" $ bindAndComposeSimple asyncly wSerially
228− describe "Bind and compose ParAhead 3" $ bindAndComposeSimple asParAhead asParAhead
228+ describe "Bind and compose ParAhead 3" $ bindAndComposeSimple asyncly asyncly
229− describe "Bind and compose ParAhead 4" $ bindAndComposeSimple asParAhead asCoparAhead
229+ describe "Bind and compose ParAhead 4" $ bindAndComposeSimple asyncly wAsyncly
230− describe "Bind and compose ParAhead 5" $ bindAndComposeSimple asParAhead asParallel
230+ describe "Bind and compose ParAhead 5" $ bindAndComposeSimple asyncly parallely
232− describe "Bind and compose CoparAhead 1" $ bindAndComposeSimple asCoparAhead asStream
232+ describe "Bind and compose CoparAhead 1" $ bindAndComposeSimple wAsyncly serially
233− describe "Bind and compose CoparAhead 2" $ bindAndComposeSimple asCoparAhead asCostream
233+ describe "Bind and compose CoparAhead 2" $ bindAndComposeSimple wAsyncly wSerially
234− describe "Bind and compose CoparAhead 3" $ bindAndComposeSimple asCoparAhead asParAhead
234+ describe "Bind and compose CoparAhead 3" $ bindAndComposeSimple wAsyncly asyncly
235− describe "Bind and compose CoparAhead 4" $ bindAndComposeSimple asCoparAhead asCoparAhead
235+ describe "Bind and compose CoparAhead 4" $ bindAndComposeSimple wAsyncly wAsyncly
236− describe "Bind and compose CoparAhead 5" $ bindAndComposeSimple asCoparAhead asParallel
236+ describe "Bind and compose CoparAhead 5" $ bindAndComposeSimple wAsyncly parallely
238− describe "Bind and compose Parallel 1" $ bindAndComposeSimple asParallel asStream
238+ describe "Bind and compose Parallel 1" $ bindAndComposeSimple parallely serially
239− describe "Bind and compose Parallel 2" $ bindAndComposeSimple asParallel asCostream
239+ describe "Bind and compose Parallel 2" $ bindAndComposeSimple parallely wSerially
240− describe "Bind and compose Parallel 3" $ bindAndComposeSimple asParallel asParAhead
240+ describe "Bind and compose Parallel 3" $ bindAndComposeSimple parallely asyncly
241− describe "Bind and compose Parallel 4" $ bindAndComposeSimple asParallel asCoparAhead
241+ describe "Bind and compose Parallel 4" $ bindAndComposeSimple parallely wAsyncly
242− describe "Bind and compose Parallel 5" $ bindAndComposeSimple asParallel asParallel
242+ describe "Bind and compose Parallel 5" $ bindAndComposeSimple parallely parallely
244 let fldr, fldl :: (IsStream t, Semigroup (t IO Int)) => [t IO Int] -> t IO Int
244 let fldr, fldl :: (IsStream t, Semigroup (t IO Int)) => [t IO Int] -> t IO Int
245 fldr = foldr (<>) nil
245 fldr = foldr (<>) nil
246 fldl = foldl (<>) nil
246 fldl = foldl (<>) nil
248 forM_ [fldr, fldl] $ \k ->
248 forM_ [fldr, fldl] $ \k ->
249− describe "Bind and compose" $ bindAndComposeHierarchy asStream asStream k
249+ describe "Bind and compose" $ bindAndComposeHierarchy serially serially k
250 forM_ [fldr, fldl] $ \k ->
250 forM_ [fldr, fldl] $ \k ->
251− describe "Bind and compose" $ bindAndComposeHierarchy asStream asCostream k
251+ describe "Bind and compose" $ bindAndComposeHierarchy serially wSerially k
252 forM_ [fldr, fldl] $ \k ->
252 forM_ [fldr, fldl] $ \k ->
253− describe "Bind and compose" $ bindAndComposeHierarchy asStream asParAhead k
253+ describe "Bind and compose" $ bindAndComposeHierarchy serially asyncly k
254 forM_ [fldr, fldl] $ \k ->
254 forM_ [fldr, fldl] $ \k ->
255− describe "Bind and compose" $ bindAndComposeHierarchy asStream asCoparAhead k
255+ describe "Bind and compose" $ bindAndComposeHierarchy serially wAsyncly k
256 forM_ [fldr, fldl] $ \k ->
256 forM_ [fldr, fldl] $ \k ->
257− describe "Bind and compose" $ bindAndComposeHierarchy asStream asParallel k
257+ describe "Bind and compose" $ bindAndComposeHierarchy serially parallely k
259 forM_ [fldr, fldl] $ \k ->
259 forM_ [fldr, fldl] $ \k ->
260− describe "Bind and compose" $ bindAndComposeHierarchy asCostream asStream k
260+ describe "Bind and compose" $ bindAndComposeHierarchy wSerially serially k
261 forM_ [fldr, fldl] $ \k ->
261 forM_ [fldr, fldl] $ \k ->
262− describe "Bind and compose" $ bindAndComposeHierarchy asCostream asCostream k
262+ describe "Bind and compose" $ bindAndComposeHierarchy wSerially wSerially k
263 forM_ [fldr, fldl] $ \k ->
263 forM_ [fldr, fldl] $ \k ->
264− describe "Bind and compose" $ bindAndComposeHierarchy asCostream asParAhead k
264+ describe "Bind and compose" $ bindAndComposeHierarchy wSerially asyncly k
265 forM_ [fldr, fldl] $ \k ->
265 forM_ [fldr, fldl] $ \k ->
266− describe "Bind and compose" $ bindAndComposeHierarchy asCostream asCoparAhead k
266+ describe "Bind and compose" $ bindAndComposeHierarchy wSerially wAsyncly k
267 forM_ [fldr, fldl] $ \k ->
267 forM_ [fldr, fldl] $ \k ->
268− describe "Bind and compose" $ bindAndComposeHierarchy asCostream asParallel k
268+ describe "Bind and compose" $ bindAndComposeHierarchy wSerially parallely k
270 forM_ [fldr, fldl] $ \k ->
270 forM_ [fldr, fldl] $ \k ->
271− describe "Bind and compose" $ bindAndComposeHierarchy asParAhead asStream k
271+ describe "Bind and compose" $ bindAndComposeHierarchy asyncly serially k
272 forM_ [fldr, fldl] $ \k ->
272 forM_ [fldr, fldl] $ \k ->
273− describe "Bind and compose" $ bindAndComposeHierarchy asParAhead asCostream k
273+ describe "Bind and compose" $ bindAndComposeHierarchy asyncly wSerially k
274 forM_ [fldr, fldl] $ \k ->
274 forM_ [fldr, fldl] $ \k ->
275− describe "Bind and compose" $ bindAndComposeHierarchy asParAhead asParAhead k
275+ describe "Bind and compose" $ bindAndComposeHierarchy asyncly asyncly k
276 forM_ [fldr, fldl] $ \k ->
276 forM_ [fldr, fldl] $ \k ->
277− describe "Bind and compose" $ bindAndComposeHierarchy asParAhead asCoparAhead k
277+ describe "Bind and compose" $ bindAndComposeHierarchy asyncly wAsyncly k
278 forM_ [fldr, fldl] $ \k ->
278 forM_ [fldr, fldl] $ \k ->
279− describe "Bind and compose" $ bindAndComposeHierarchy asParAhead asParallel k
279+ describe "Bind and compose" $ bindAndComposeHierarchy asyncly parallely k
281 forM_ [fldr, fldl] $ \k ->
281 forM_ [fldr, fldl] $ \k ->
282− describe "Bind and compose" $ bindAndComposeHierarchy asCoparAhead asStream k
282+ describe "Bind and compose" $ bindAndComposeHierarchy wAsyncly serially k
283 forM_ [fldr, fldl] $ \k ->
283 forM_ [fldr, fldl] $ \k ->
284− describe "Bind and compose" $ bindAndComposeHierarchy asCoparAhead asCostream k
284+ describe "Bind and compose" $ bindAndComposeHierarchy wAsyncly wSerially k
285 forM_ [fldr, fldl] $ \k ->
285 forM_ [fldr, fldl] $ \k ->
286− describe "Bind and compose" $ bindAndComposeHierarchy asCoparAhead asParAhead k
286+ describe "Bind and compose" $ bindAndComposeHierarchy wAsyncly asyncly k
287 forM_ [fldr, fldl] $ \k ->
287 forM_ [fldr, fldl] $ \k ->
288− describe "Bind and compose" $ bindAndComposeHierarchy asCoparAhead asCoparAhead k
288+ describe "Bind and compose" $ bindAndComposeHierarchy wAsyncly wAsyncly k
289 forM_ [fldr, fldl] $ \k ->
289 forM_ [fldr, fldl] $ \k ->
290− describe "Bind and compose" $ bindAndComposeHierarchy asCoparAhead asParallel k
290+ describe "Bind and compose" $ bindAndComposeHierarchy wAsyncly parallely k
292 forM_ [fldr, fldl] $ \k ->
292 forM_ [fldr, fldl] $ \k ->
293− describe "Bind and compose" $ bindAndComposeHierarchy asParallel asStream k
293+ describe "Bind and compose" $ bindAndComposeHierarchy parallely serially k
294 forM_ [fldr, fldl] $ \k ->
294 forM_ [fldr, fldl] $ \k ->
295− describe "Bind and compose" $ bindAndComposeHierarchy asParallel asCostream k
295+ describe "Bind and compose" $ bindAndComposeHierarchy parallely wSerially k
296 forM_ [fldr, fldl] $ \k ->
296 forM_ [fldr, fldl] $ \k ->
297− describe "Bind and compose" $ bindAndComposeHierarchy asParallel asParAhead k
297+ describe "Bind and compose" $ bindAndComposeHierarchy parallely asyncly k
298 forM_ [fldr, fldl] $ \k ->
298 forM_ [fldr, fldl] $ \k ->
299− describe "Bind and compose" $ bindAndComposeHierarchy asParallel asCoparAhead k
299+ describe "Bind and compose" $ bindAndComposeHierarchy parallely wAsyncly k
300 forM_ [fldr, fldl] $ \k ->
300 forM_ [fldr, fldl] $ \k ->
301− describe "Bind and compose" $ bindAndComposeHierarchy asParallel asParallel k
301+ describe "Bind and compose" $ bindAndComposeHierarchy parallely parallely k
303 -- Nest two lists using different styles of product compositions
303 -- Nest two lists using different styles of product compositions
304 it "Nests two streams using monadic serial composition" nestTwoSerial
304 it "Nests two streams using monadic serial composition" nestTwoSerial
@@ -322,20 +322,20 @@ main = hspec $ do
322 describe "Simple MonadError and MonadThrow" simpleMonadError
322 describe "Simple MonadError and MonadThrow" simpleMonadError
325− describe "Composed MonadError asStream" $ composeWithMonadError asStream
325+ describe "Composed MonadError serially" $ composeWithMonadError serially
326− describe "Composed MonadError asCostream" $ composeWithMonadError asCostream
326+ describe "Composed MonadError wSerially" $ composeWithMonadError wSerially
327− describe "Composed MonadError asParAhead" $ composeWithMonadError asParAhead
327+ describe "Composed MonadError asyncly" $ composeWithMonadError asyncly
328− describe "Composed MonadError asCoparAhead" $ composeWithMonadError asCoparAhead
328+ describe "Composed MonadError wAsyncly" $ composeWithMonadError wAsyncly
331− describe "Composed MonadThrow asStream" $ composeWithMonadThrow asStream
331+ describe "Composed MonadThrow serially" $ composeWithMonadThrow serially
332− describe "Composed MonadThrow asCostream" $ composeWithMonadThrow asCostream
332+ describe "Composed MonadThrow wSerially" $ composeWithMonadThrow wSerially
333− describe "Composed MonadThrow asParAhead" $ composeWithMonadThrow asParAhead
333+ describe "Composed MonadThrow asyncly" $ composeWithMonadThrow asyncly
334− describe "Composed MonadThrow asCoparAhead" $ composeWithMonadThrow asCoparAhead
334+ describe "Composed MonadThrow wAsyncly" $ composeWithMonadThrow wAsyncly
335− describe "Composed MonadThrow asParallel" $ composeWithMonadThrow asParallel
335+ describe "Composed MonadThrow parallely" $ composeWithMonadThrow parallely
337 it "Crosses thread limit (2000 threads)" $
337 it "Crosses thread limit (2000 threads)" $
338− runStream (asParAhead $ fold $
338+ runStream (asyncly $ fold $
339 replicate 2000 $ A.once $ threadDelay 1000000)
339 replicate 2000 $ A.once $ threadDelay 1000000)
340 `shouldReturn` ()
340 `shouldReturn` ()
@@ -368,7 +368,7 @@ composeWithMonadThrow
368 , Semigroup (t IO Int)
368 , Semigroup (t IO Int)
369 , MonadThrow (t IO)
369 , MonadThrow (t IO)
371− => (t IO Int -> StreamT IO Int) -> Spec
371+ => (t IO Int -> SerialT IO Int) -> Spec
372composeWithMonadThrow t = do
372composeWithMonadThrow t = do
373 it "Compose throwM, nil" $
373 it "Compose throwM, nil" $
374 (try $ tl (throwM (ExampleException "E") <> A.nil))
374 (try $ tl (throwM (ExampleException "E") <> A.nil))
@@ -376,16 +376,16 @@ composeWithMonadThrow t = do
376 it "Compose nil, throwM" $
376 it "Compose nil, throwM" $
377 (try $ tl (A.nil <> throwM (ExampleException "E")))
377 (try $ tl (A.nil <> throwM (ExampleException "E")))
378 `shouldReturn` (Left (ExampleException "E") :: Either ExampleException [Int])
378 `shouldReturn` (Left (ExampleException "E") :: Either ExampleException [Int])
379− oneLevelNestedSum "asStream" asStream
379+ oneLevelNestedSum "serially" serially
380− oneLevelNestedSum "asCostream" asCostream
380+ oneLevelNestedSum "wSerially" wSerially
381− oneLevelNestedSum "asParAhead" asParAhead
381+ oneLevelNestedSum "asyncly" asyncly
382− oneLevelNestedSum "asCoparAhead" asCoparAhead
382+ oneLevelNestedSum "wAsyncly" wAsyncly
383 -- XXX add two level nesting
383 -- XXX add two level nesting
385− oneLevelNestedProduct "asStream" asStream
385+ oneLevelNestedProduct "serially" serially
386− oneLevelNestedProduct "asCostream" asCostream
386+ oneLevelNestedProduct "wSerially" wSerially
387− oneLevelNestedProduct "asParAhead" asParAhead
387+ oneLevelNestedProduct "asyncly" asyncly
388− oneLevelNestedProduct "asCoparAhead" asCoparAhead
388+ oneLevelNestedProduct "wAsyncly" wAsyncly
391 tl = A.toList . t
391 tl = A.toList . t
@@ -414,7 +414,7 @@ _composeWithMonadError
414 , Semigroup (t (ExceptT String IO) Int)
414 , Semigroup (t (ExceptT String IO) Int)
415 , MonadError String (t (ExceptT String IO))
415 , MonadError String (t (ExceptT String IO))
417− => (t (ExceptT String IO) Int -> StreamT (ExceptT String IO) Int) -> Spec
417+ => (t (ExceptT String IO) Int -> SerialT (ExceptT String IO) Int) -> Spec
418_composeWithMonadError t = do
418_composeWithMonadError t = do
419 let tl = A.toList . t
419 let tl = A.toList . t
420 it "Compose throwError, nil" $
420 it "Compose throwError, nil" $
@@ -478,7 +478,7 @@ nestTwoCoparAhead :: Expectation
478nestTwoCoparAhead =
478nestTwoCoparAhead =
479 let s1 = foldMapWith (<>) return [1..4]
479 let s1 = foldMapWith (<>) return [1..4]
480 s2 = foldMapWith (<>) return [5..8]
480 s2 = foldMapWith (<>) return [5..8]
481− in ((A.toList . asCoparAhead) (do
481+ in ((A.toList . wAsyncly) (do
484 return (x + y)
484 return (x + y)
@@ -489,7 +489,7 @@ nestTwoParallel :: Expectation
489nestTwoParallel =
489nestTwoParallel =
490 let s1 = foldMapWith (<>) return [1..4]
490 let s1 = foldMapWith (<>) return [1..4]
491 s2 = foldMapWith (<>) return [5..8]
491 s2 = foldMapWith (<>) return [5..8]
492− in ((A.toList . asParallel) (do
492+ in ((A.toList . parallely) (do
495 return (x + y)
495 return (x + y)
@@ -500,21 +500,21 @@ nestTwoCoparAheadApp :: Expectation
500nestTwoCoparAheadApp =
500nestTwoCoparAheadApp =
501 let s1 = foldMapWith (<>) return [1..4]
501 let s1 = foldMapWith (<>) return [1..4]
502 s2 = foldMapWith (<>) return [5..8]
502 s2 = foldMapWith (<>) return [5..8]
503− in ((A.toList . asCoparAhead) ((+) <$> s1 <*> s2) >>= return . sort)
503+ in ((A.toList . wAsyncly) ((+) <$> s1 <*> s2) >>= return . sort)
504 `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
504 `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
506nestTwoParallelApp :: Expectation
506nestTwoParallelApp :: Expectation
507nestTwoParallelApp =
507nestTwoParallelApp =
508 let s1 = foldMapWith (<>) return [1..4]
508 let s1 = foldMapWith (<>) return [1..4]
509 s2 = foldMapWith (<>) return [5..8]
509 s2 = foldMapWith (<>) return [5..8]
510− in ((A.toList . asParallel) ((+) <$> s1 <*> s2) >>= return . sort)
510+ in ((A.toList . parallely) ((+) <$> s1 <*> s2) >>= return . sort)
511 `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
511 `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
513timed :: (IsStream t, Monad (t IO)) => Int -> t IO Int
513timed :: (IsStream t, Monad (t IO)) => Int -> t IO Int
514timed x = A.once (threadDelay (x * 100000)) >> return x
514timed x = A.once (threadDelay (x * 100000)) >> return x
516interleaveCheck :: IsStream t
516interleaveCheck :: IsStream t
517− => (t IO Int -> StreamT IO Int)
517+ => (t IO Int -> SerialT IO Int)
518 -> (t IO Int -> t IO Int -> t IO Int)
518 -> (t IO Int -> t IO Int -> t IO Int)
520interleaveCheck t f =
520interleaveCheck t f =
@@ -523,7 +523,7 @@ interleaveCheck t f =
523 `shouldReturn` ([0, 100, 1, 101])
523 `shouldReturn` ([0, 100, 1, 101])
525parallelCheck :: (IsStream t, Monad (t IO))
525parallelCheck :: (IsStream t, Monad (t IO))
526− => (t IO Int -> StreamT IO Int)
526+ => (t IO Int -> SerialT IO Int)
527 -> (t IO Int -> t IO Int -> t IO Int)
527 -> (t IO Int -> t IO Int -> t IO Int)
529parallelCheck t f = do
529parallelCheck t f = do
@@ -538,7 +538,7 @@ parallelCheck t f = do
538 where event n = (A.once $ threadDelay (n * 100000)) >> (return n)
538 where event n = (A.once $ threadDelay (n * 100000)) >> (return n)
540compose :: (IsStream t, Semigroup (t IO Int))
540compose :: (IsStream t, Semigroup (t IO Int))
541− => (t IO Int -> StreamT IO Int) -> t IO Int -> ([Int] -> [Int]) -> Spec
541+ => (t IO Int -> SerialT IO Int) -> t IO Int -> ([Int] -> [Int]) -> Spec
542compose t z srt = do
542compose t z srt = do
543 -- XXX these should get covered by the property tests
543 -- XXX these should get covered by the property tests
544 it "Compose mempty, mempty" $
544 it "Compose mempty, mempty" $
@@ -577,7 +577,7 @@ composeAndComposeSimple
577 , Semigroup (t2 IO Int)
577 , Semigroup (t2 IO Int)
580− => (t1 IO Int -> StreamT IO Int)
580+ => (t1 IO Int -> SerialT IO Int)
581 -> (t2 IO Int -> t2 IO Int)
581 -> (t2 IO Int -> t2 IO Int)
582 -> [[Int]] -> Spec
582 -> [[Int]] -> Spec
583composeAndComposeSimple t1 t2 answer = do
583composeAndComposeSimple t1 t2 answer = do
@@ -625,7 +625,7 @@ loops t tsrt hsrt = do
626bindAndComposeSimple
626bindAndComposeSimple
627 :: ( IsStream t1, IsStream t2, Semigroup (t2 IO Int), Monad (t2 IO))
627 :: ( IsStream t1, IsStream t2, Semigroup (t2 IO Int), Monad (t2 IO))
628− => (t1 IO Int -> StreamT IO Int)
628+ => (t1 IO Int -> SerialT IO Int)
629 -> (t2 IO Int -> t2 IO Int)
629 -> (t2 IO Int -> t2 IO Int)
631bindAndComposeSimple t1 t2 = do
631bindAndComposeSimple t1 t2 = do
@@ -642,7 +642,7 @@ bindAndComposeSimple t1 t2 = do
642bindAndComposeHierarchy
642bindAndComposeHierarchy
643 :: ( IsStream t1, Monad (t1 IO)
643 :: ( IsStream t1, Monad (t1 IO)
644 , IsStream t2, Monad (t2 IO))
644 , IsStream t2, Monad (t2 IO))
645− => (t1 IO Int -> StreamT IO Int)
645+ => (t1 IO Int -> SerialT IO Int)
646 -> (t2 IO Int -> t2 IO Int)
646 -> (t2 IO Int -> t2 IO Int)
647 -> ([t2 IO Int] -> t2 IO Int)
647 -> ([t2 IO Int] -> t2 IO Int)
@@ -659,7 +659,7 @@ bindAndComposeHierarchy t1 t2 g = do
662− -- bindComposeNested :: ACoparAheadT IO Int
662+ -- bindComposeNested :: WAsyncT IO Int
663 bindComposeNested =
663 bindComposeNested =
664 let c1 = tripleCompose (return 1) (return 2) (return 3)
664 let c1 = tripleCompose (return 1) (return 2) (return 3)
665 c2 = tripleCompose (return 4) (return 5) (return 6)
665 c2 = tripleCompose (return 4) (return 5) (return 6)
@@ -686,21 +686,21 @@ mixedOps = do
686 ] :: [Int])
686 ] :: [Int])
689− composeMixed :: StreamT IO Int
689+ composeMixed :: SerialT IO Int
690 composeMixed = do
690 composeMixed = do
691 A.once $ return ()
691 A.once $ return ()
692 A.once $ putStr ""
692 A.once $ putStr ""
693 x <- return 1
693 x <- return 1
694 y <- return 2
694 y <- return 2
696− x1 <- asCoparAhead $ return 1 <> return 2
696+ x1 <- wAsyncly $ return 1 <> return 2
697 A.once $ return ()
697 A.once $ return ()
698 A.once $ putStr ""
698 A.once $ putStr ""
699− y1 <- asParAhead $ return 1 <> return 2
699+ y1 <- asyncly $ return 1 <> return 2
701 x11 <- return 1 <> return 2
701 x11 <- return 1 <> return 2
702− y11 <- asParAhead $ return 1 <> return 2
702+ y11 <- asyncly $ return 1 <> return 2
703− z11 <- asCostream $ return 1 <> return 2
703+ z11 <- wSerially $ return 1 <> return 2
704 A.once $ return ()
704 A.once $ return ()
705 A.once $ putStr ""
705 A.once $ putStr ""
706 return (x11 + y11 + z11)
706 return (x11 + y11 + z11)