@@ -20,27 +20,27 @@ import qualified Streamly.Prelude as A
2020singleton :: IsStream t => a -> t m a
2121singleton a = a .: nil
2222
23−toListSerial :: StreamT IO a -> IO [a]
24−toListSerial = A.toList . asStream
23+toListSerial :: SerialT IO a -> IO [a]
24+toListSerial = A.toList . serially
2525
26−toListInterleaved :: CostreamT IO a -> IO [a]
27−toListInterleaved = A.toList . asCostream
26+toListInterleaved :: WSerialT IO a -> IO [a]
27+toListInterleaved = A.toList . wSerially
2828
29−toListAsync :: ParAheadT IO a -> IO [a]
30−toListAsync = A.toList . asParAhead
29+toListAsync :: AsyncT IO a -> IO [a]
30+toListAsync = A.toList . asyncly
3131
32−toListParallel :: CoparAheadT IO a -> IO [a]
33−toListParallel = A.toList . asCoparAhead
32+toListParallel :: WAsyncT IO a -> IO [a]
33+toListParallel = A.toList . wAsyncly
3434
3535main :: IO ()
3636main = hspec $ do
3737 describe "Runners" $ do
3838 -- XXX move these to property tests
3939 -- XXX use an IORef to store and check the side effects
40− it "simple asStream" $
41− (runStream . asStream) (return (0 :: Int)) `shouldReturn` ()
42− it "simple asStream with IO" $
43− (runStream . asStream) (A.once $ putStrLn "hello") `shouldReturn` ()
40+ it "simple serially" $
41+ (runStream . serially) (return (0 :: Int)) `shouldReturn` ()
42+ it "simple serially with IO" $
43+ (runStream . serially) (A.once $ putStrLn "hello") `shouldReturn` ()
4444
4545 describe "Empty" $ do
4646 it "Monoid - mempty" $
@@ -96,31 +96,31 @@ main = hspec $ do
9696 -- for Monoid that is using the right version of semigroup. Instance
9797 -- deriving can cause us to pick wrong instances sometimes.
9898
99− describe "Serial interleaved (<>) ordering check" $ interleaveCheck asCostream (<>)
100− describe "Serial interleaved mappend ordering check" $ interleaveCheck asCostream mappend
99+ describe "Serial interleaved (<>) ordering check" $ interleaveCheck wSerially (<>)
100+ describe "Serial interleaved mappend ordering check" $ interleaveCheck wSerially mappend
101101
102− describe "Parallel interleaved (<>) ordering check" $ interleaveCheck asCoparAhead (<>)
103− describe "Parallel interleaved mappend ordering check" $ interleaveCheck asCoparAhead mappend
102+ describe "Parallel interleaved (<>) ordering check" $ interleaveCheck wAsyncly (<>)
103+ describe "Parallel interleaved mappend ordering check" $ interleaveCheck wAsyncly mappend
104104
105− -- describe "Parallel (<>) ordering check" $ interleaveCheck asParallel (<>)
106− -- describe "Parallel mappend ordering check" $ interleaveCheck asParallel mappend
105+ -- describe "Parallel (<>) ordering check" $ interleaveCheck parallely (<>)
106+ -- describe "Parallel mappend ordering check" $ interleaveCheck parallely mappend
107107
108− describe "ParAhead (<>) time order check" $ parallelCheck asParAhead (<>)
109− describe "ParAhead mappend time order check" $ parallelCheck asParAhead mappend
110− describe "CoparAhead (<>) time order check" $ parallelCheck asCoparAhead (<>)
111− describe "CoparAhead mappend time order check" $ parallelCheck asCoparAhead mappend
108+ describe "ParAhead (<>) time order check" $ parallelCheck asyncly (<>)
109+ describe "ParAhead mappend time order check" $ parallelCheck asyncly mappend
110+ describe "CoparAhead (<>) time order check" $ parallelCheck wAsyncly (<>)
111+ describe "CoparAhead mappend time order check" $ parallelCheck wAsyncly mappend
112112
113113 ---------------------------------------------------------------------------
114114 -- Monoidal Compositions, multiset equality checks
115115 ---------------------------------------------------------------------------
116116
117− describe "Serial Composition" $ compose asStream mempty id
118− describe "Interleaved Composition" $ compose asCostream mempty sort
119− describe "ParAhead Composition" $ compose asParAhead mempty sort
120− describe "CoparAhead Composition" $ compose asCoparAhead mempty sort
121− describe "Parallel Composition" $ compose asParallel mempty sort
122− describe "Semigroup Composition for ZipSerial" $ compose asZipStream mempty id
123− describe "Semigroup Composition for ZipAsync" $ compose asZipParallel mempty id
117+ describe "Serial Composition" $ compose serially mempty id
118+ describe "Interleaved Composition" $ compose wSerially mempty sort
119+ describe "ParAhead Composition" $ compose asyncly mempty sort
120+ describe "CoparAhead Composition" $ compose wAsyncly mempty sort
121+ describe "Parallel Composition" $ compose parallely mempty sort
122+ describe "Semigroup Composition for ZipSerial" $ compose zipSerially mempty id
123+ describe "Semigroup Composition for ZipAsync" $ compose zipAsyncly mempty id
124124 -- XXX need to check alternative compositions as well
125125
126126 ---------------------------------------------------------------------------
@@ -128,11 +128,11 @@ main = hspec $ do
128128 ---------------------------------------------------------------------------
129129
130130 -- 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]])
132132
133133 describe "<> and <=>" $ composeAndComposeSimple
134− asStream
135− asCostream
134+ serially
135+ wSerially
136136 ([ [1 .. 9]
137137 , [1 .. 9]
138138 , [1, 3, 2, 4, 6, 5, 7, 9, 8]
@@ -140,8 +140,8 @@ main = hspec $ do
140140 ])
141141
142142 describe "<=> and <=>" $ composeAndComposeSimple
143− asCostream
144− asCostream
143+ wSerially
144+ wSerially
145145 ([ [1, 4, 2, 7, 3, 5, 8, 6, 9]
146146 , [1, 7, 4, 8, 2, 9, 5, 3, 6]
147147 , [1, 4, 3, 7, 2, 6, 9, 5, 8]
@@ -149,8 +149,8 @@ main = hspec $ do
149149 ])
150150
151151 describe "<=> and <>" $ composeAndComposeSimple
152− asCostream
153− asStream
152+ wSerially
153+ serially
154154 ([ [1, 4, 2, 7, 3, 5, 8, 6, 9]
155155 , [1, 7, 4, 8, 2, 9, 5, 3, 6]
156156 , [1, 4, 2, 7, 3, 5, 8, 6, 9]
@@ -159,8 +159,8 @@ main = hspec $ do
159159
160160 describe "Nested parallel and serial compositions" $ do
161161 let t = timed
162− p = asCoparAhead
163− s = asStream
162+ p = wAsyncly
163+ s = serially
164164 {-
165165 -- This is not correct, the result can also be [4,4,8,0,8,0,2,2]
166166 -- because of parallelism of [8,0] and [8,0].
@@ -172,7 +172,7 @@ main = hspec $ do
172172 `shouldReturn` ([4,4,8,8,0,0,2,2])
173173 -}
174174 it "Nest <|>, <>, <|> (2)" $
175− (A.toList . asCoparAhead) (
175+ (A.toList . wAsyncly) (
176176 s (p (t 4 <> t 8) <> p (t 1 <> t 2))
177177 <> s (p (t 4 <> t 8) <> p (t 1 <> t 2)))
178178 `shouldReturn` ([4,4,8,8,1,1,2,2])
@@ -193,7 +193,7 @@ main = hspec $ do
193193 `shouldReturn` ([4,4,1,1,8,2,9,2])
194194 -}
195195 it "Nest <|>, <|>, <|>" $
196− (A.toList . asCoparAhead) (
196+ (A.toList . wAsyncly) (
197197 ((t 4 <> t 8) <> (t 0 <> t 2))
198198 <> ((t 4 <> t 8) <> (t 0 <> t 2)))
199199 `shouldReturn` ([0,0,2,2,4,4,8,8])
@@ -202,103 +202,103 @@ main = hspec $ do
202202 -- Monoidal composition recursion loops
203203 ---------------------------------------------------------------------------
204204
205− describe "Serial loops" $ loops asStream id reverse
206− describe "ParAhead parallel loops" $ loops asParAhead sort sort
207− describe "coparAhead loops" $ loops asCoparAhead sort sort
208− describe "parallel loops" $ loops asParallel sort sort
205+ describe "Serial loops" $ loops serially id reverse
206+ describe "ParAhead parallel loops" $ loops asyncly sort sort
207+ describe "coparAhead loops" $ loops wAsyncly sort sort
208+ describe "parallel loops" $ loops parallely sort sort
209209
210210 ---------------------------------------------------------------------------
211211 -- Bind and monoidal composition combinations
212212 ---------------------------------------------------------------------------
213213
214− describe "Bind and compose Stream 1" $ bindAndComposeSimple asStream asStream
215− describe "Bind and compose Stream 2" $ bindAndComposeSimple asStream asCostream
216− describe "Bind and compose Stream 3" $ bindAndComposeSimple asStream asParAhead
217− describe "Bind and compose Stream 4" $ bindAndComposeSimple asStream asCoparAhead
218− describe "Bind and compose Stream 5" $ bindAndComposeSimple asStream asParallel
219−
220− describe "Bind and compose Costream 1" $ bindAndComposeSimple asCostream asStream
221− describe "Bind and compose Costream 2" $ bindAndComposeSimple asCostream asCostream
222− describe "Bind and compose Costream 3" $ bindAndComposeSimple asCostream asParAhead
223− describe "Bind and compose Costream 4" $ bindAndComposeSimple asCostream asCoparAhead
224− describe "Bind and compose Costream 5" $ bindAndComposeSimple asCostream asParallel
225−
226− describe "Bind and compose ParAhead 1" $ bindAndComposeSimple asParAhead asStream
227− describe "Bind and compose ParAhead 2" $ bindAndComposeSimple asParAhead asCostream
228− describe "Bind and compose ParAhead 3" $ bindAndComposeSimple asParAhead asParAhead
229− describe "Bind and compose ParAhead 4" $ bindAndComposeSimple asParAhead asCoparAhead
230− describe "Bind and compose ParAhead 5" $ bindAndComposeSimple asParAhead asParallel
231−
232− describe "Bind and compose CoparAhead 1" $ bindAndComposeSimple asCoparAhead asStream
233− describe "Bind and compose CoparAhead 2" $ bindAndComposeSimple asCoparAhead asCostream
234− describe "Bind and compose CoparAhead 3" $ bindAndComposeSimple asCoparAhead asParAhead
235− describe "Bind and compose CoparAhead 4" $ bindAndComposeSimple asCoparAhead asCoparAhead
236− describe "Bind and compose CoparAhead 5" $ bindAndComposeSimple asCoparAhead asParallel
237−
238− describe "Bind and compose Parallel 1" $ bindAndComposeSimple asParallel asStream
239− describe "Bind and compose Parallel 2" $ bindAndComposeSimple asParallel asCostream
240− describe "Bind and compose Parallel 3" $ bindAndComposeSimple asParallel asParAhead
241− describe "Bind and compose Parallel 4" $ bindAndComposeSimple asParallel asCoparAhead
242− describe "Bind and compose Parallel 5" $ bindAndComposeSimple asParallel asParallel
214+ describe "Bind and compose Stream 1" $ bindAndComposeSimple serially serially
215+ describe "Bind and compose Stream 2" $ bindAndComposeSimple serially wSerially
216+ describe "Bind and compose Stream 3" $ bindAndComposeSimple serially asyncly
217+ describe "Bind and compose Stream 4" $ bindAndComposeSimple serially wAsyncly
218+ describe "Bind and compose Stream 5" $ bindAndComposeSimple serially parallely
219+
220+ describe "Bind and compose Costream 1" $ bindAndComposeSimple wSerially serially
221+ describe "Bind and compose Costream 2" $ bindAndComposeSimple wSerially wSerially
222+ describe "Bind and compose Costream 3" $ bindAndComposeSimple wSerially asyncly
223+ describe "Bind and compose Costream 4" $ bindAndComposeSimple wSerially wAsyncly
224+ describe "Bind and compose Costream 5" $ bindAndComposeSimple wSerially parallely
225+
226+ describe "Bind and compose ParAhead 1" $ bindAndComposeSimple asyncly serially
227+ describe "Bind and compose ParAhead 2" $ bindAndComposeSimple asyncly wSerially
228+ describe "Bind and compose ParAhead 3" $ bindAndComposeSimple asyncly asyncly
229+ describe "Bind and compose ParAhead 4" $ bindAndComposeSimple asyncly wAsyncly
230+ describe "Bind and compose ParAhead 5" $ bindAndComposeSimple asyncly parallely
231+
232+ describe "Bind and compose CoparAhead 1" $ bindAndComposeSimple wAsyncly serially
233+ describe "Bind and compose CoparAhead 2" $ bindAndComposeSimple wAsyncly wSerially
234+ describe "Bind and compose CoparAhead 3" $ bindAndComposeSimple wAsyncly asyncly
235+ describe "Bind and compose CoparAhead 4" $ bindAndComposeSimple wAsyncly wAsyncly
236+ describe "Bind and compose CoparAhead 5" $ bindAndComposeSimple wAsyncly parallely
237+
238+ describe "Bind and compose Parallel 1" $ bindAndComposeSimple parallely serially
239+ describe "Bind and compose Parallel 2" $ bindAndComposeSimple parallely wSerially
240+ describe "Bind and compose Parallel 3" $ bindAndComposeSimple parallely asyncly
241+ describe "Bind and compose Parallel 4" $ bindAndComposeSimple parallely wAsyncly
242+ describe "Bind and compose Parallel 5" $ bindAndComposeSimple parallely parallely
243243
244244 let fldr, fldl :: (IsStream t, Semigroup (t IO Int)) => [t IO Int] -> t IO Int
245245 fldr = foldr (<>) nil
246246 fldl = foldl (<>) nil
247247
248248 forM_ [fldr, fldl] $ \k ->
249− describe "Bind and compose" $ bindAndComposeHierarchy asStream asStream k
249+ describe "Bind and compose" $ bindAndComposeHierarchy serially serially k
250250 forM_ [fldr, fldl] $ \k ->
251− describe "Bind and compose" $ bindAndComposeHierarchy asStream asCostream k
251+ describe "Bind and compose" $ bindAndComposeHierarchy serially wSerially k
252252 forM_ [fldr, fldl] $ \k ->
253− describe "Bind and compose" $ bindAndComposeHierarchy asStream asParAhead k
253+ describe "Bind and compose" $ bindAndComposeHierarchy serially asyncly k
254254 forM_ [fldr, fldl] $ \k ->
255− describe "Bind and compose" $ bindAndComposeHierarchy asStream asCoparAhead k
255+ describe "Bind and compose" $ bindAndComposeHierarchy serially wAsyncly k
256256 forM_ [fldr, fldl] $ \k ->
257− describe "Bind and compose" $ bindAndComposeHierarchy asStream asParallel k
257+ describe "Bind and compose" $ bindAndComposeHierarchy serially parallely k
258258
259259 forM_ [fldr, fldl] $ \k ->
260− describe "Bind and compose" $ bindAndComposeHierarchy asCostream asStream k
260+ describe "Bind and compose" $ bindAndComposeHierarchy wSerially serially k
261261 forM_ [fldr, fldl] $ \k ->
262− describe "Bind and compose" $ bindAndComposeHierarchy asCostream asCostream k
262+ describe "Bind and compose" $ bindAndComposeHierarchy wSerially wSerially k
263263 forM_ [fldr, fldl] $ \k ->
264− describe "Bind and compose" $ bindAndComposeHierarchy asCostream asParAhead k
264+ describe "Bind and compose" $ bindAndComposeHierarchy wSerially asyncly k
265265 forM_ [fldr, fldl] $ \k ->
266− describe "Bind and compose" $ bindAndComposeHierarchy asCostream asCoparAhead k
266+ describe "Bind and compose" $ bindAndComposeHierarchy wSerially wAsyncly k
267267 forM_ [fldr, fldl] $ \k ->
268− describe "Bind and compose" $ bindAndComposeHierarchy asCostream asParallel k
268+ describe "Bind and compose" $ bindAndComposeHierarchy wSerially parallely k
269269
270270 forM_ [fldr, fldl] $ \k ->
271− describe "Bind and compose" $ bindAndComposeHierarchy asParAhead asStream k
271+ describe "Bind and compose" $ bindAndComposeHierarchy asyncly serially k
272272 forM_ [fldr, fldl] $ \k ->
273− describe "Bind and compose" $ bindAndComposeHierarchy asParAhead asCostream k
273+ describe "Bind and compose" $ bindAndComposeHierarchy asyncly wSerially k
274274 forM_ [fldr, fldl] $ \k ->
275− describe "Bind and compose" $ bindAndComposeHierarchy asParAhead asParAhead k
275+ describe "Bind and compose" $ bindAndComposeHierarchy asyncly asyncly k
276276 forM_ [fldr, fldl] $ \k ->
277− describe "Bind and compose" $ bindAndComposeHierarchy asParAhead asCoparAhead k
277+ describe "Bind and compose" $ bindAndComposeHierarchy asyncly wAsyncly k
278278 forM_ [fldr, fldl] $ \k ->
279− describe "Bind and compose" $ bindAndComposeHierarchy asParAhead asParallel k
279+ describe "Bind and compose" $ bindAndComposeHierarchy asyncly parallely k
280280
281281 forM_ [fldr, fldl] $ \k ->
282− describe "Bind and compose" $ bindAndComposeHierarchy asCoparAhead asStream k
282+ describe "Bind and compose" $ bindAndComposeHierarchy wAsyncly serially k
283283 forM_ [fldr, fldl] $ \k ->
284− describe "Bind and compose" $ bindAndComposeHierarchy asCoparAhead asCostream k
284+ describe "Bind and compose" $ bindAndComposeHierarchy wAsyncly wSerially k
285285 forM_ [fldr, fldl] $ \k ->
286− describe "Bind and compose" $ bindAndComposeHierarchy asCoparAhead asParAhead k
286+ describe "Bind and compose" $ bindAndComposeHierarchy wAsyncly asyncly k
287287 forM_ [fldr, fldl] $ \k ->
288− describe "Bind and compose" $ bindAndComposeHierarchy asCoparAhead asCoparAhead k
288+ describe "Bind and compose" $ bindAndComposeHierarchy wAsyncly wAsyncly k
289289 forM_ [fldr, fldl] $ \k ->
290− describe "Bind and compose" $ bindAndComposeHierarchy asCoparAhead asParallel k
290+ describe "Bind and compose" $ bindAndComposeHierarchy wAsyncly parallely k
291291
292292 forM_ [fldr, fldl] $ \k ->
293− describe "Bind and compose" $ bindAndComposeHierarchy asParallel asStream k
293+ describe "Bind and compose" $ bindAndComposeHierarchy parallely serially k
294294 forM_ [fldr, fldl] $ \k ->
295− describe "Bind and compose" $ bindAndComposeHierarchy asParallel asCostream k
295+ describe "Bind and compose" $ bindAndComposeHierarchy parallely wSerially k
296296 forM_ [fldr, fldl] $ \k ->
297− describe "Bind and compose" $ bindAndComposeHierarchy asParallel asParAhead k
297+ describe "Bind and compose" $ bindAndComposeHierarchy parallely asyncly k
298298 forM_ [fldr, fldl] $ \k ->
299− describe "Bind and compose" $ bindAndComposeHierarchy asParallel asCoparAhead k
299+ describe "Bind and compose" $ bindAndComposeHierarchy parallely wAsyncly k
300300 forM_ [fldr, fldl] $ \k ->
301− describe "Bind and compose" $ bindAndComposeHierarchy asParallel asParallel k
301+ describe "Bind and compose" $ bindAndComposeHierarchy parallely parallely k
302302
303303 -- Nest two lists using different styles of product compositions
304304 it "Nests two streams using monadic serial composition" nestTwoSerial
@@ -322,20 +322,20 @@ main = hspec $ do
322322 describe "Simple MonadError and MonadThrow" simpleMonadError
323323
324324 {-
325− describe "Composed MonadError asStream" $ composeWithMonadError asStream
326− describe "Composed MonadError asCostream" $ composeWithMonadError asCostream
327− describe "Composed MonadError asParAhead" $ composeWithMonadError asParAhead
328− describe "Composed MonadError asCoparAhead" $ composeWithMonadError asCoparAhead
325+ describe "Composed MonadError serially" $ composeWithMonadError serially
326+ describe "Composed MonadError wSerially" $ composeWithMonadError wSerially
327+ describe "Composed MonadError asyncly" $ composeWithMonadError asyncly
328+ describe "Composed MonadError wAsyncly" $ composeWithMonadError wAsyncly
329329 -}
330330
331− describe "Composed MonadThrow asStream" $ composeWithMonadThrow asStream
332− describe "Composed MonadThrow asCostream" $ composeWithMonadThrow asCostream
333− describe "Composed MonadThrow asParAhead" $ composeWithMonadThrow asParAhead
334− describe "Composed MonadThrow asCoparAhead" $ composeWithMonadThrow asCoparAhead
335− describe "Composed MonadThrow asParallel" $ composeWithMonadThrow asParallel
331+ describe "Composed MonadThrow serially" $ composeWithMonadThrow serially
332+ describe "Composed MonadThrow wSerially" $ composeWithMonadThrow wSerially
333+ describe "Composed MonadThrow asyncly" $ composeWithMonadThrow asyncly
334+ describe "Composed MonadThrow wAsyncly" $ composeWithMonadThrow wAsyncly
335+ describe "Composed MonadThrow parallely" $ composeWithMonadThrow parallely
336336
337337 it "Crosses thread limit (2000 threads)" $
338− runStream (asParAhead $ fold $
338+ runStream (asyncly $ fold $
339339 replicate 2000 $ A.once $ threadDelay 1000000)
340340 `shouldReturn` ()
341341
@@ -368,7 +368,7 @@ composeWithMonadThrow
368368 , Semigroup (t IO Int)
369369 , MonadThrow (t IO)
370370 )
371− => (t IO Int -> StreamT IO Int) -> Spec
371+ => (t IO Int -> SerialT IO Int) -> Spec
372372composeWithMonadThrow t = do
373373 it "Compose throwM, nil" $
374374 (try $ tl (throwM (ExampleException "E") <> A.nil))
@@ -376,16 +376,16 @@ composeWithMonadThrow t = do
376376 it "Compose nil, throwM" $
377377 (try $ tl (A.nil <> throwM (ExampleException "E")))
378378 `shouldReturn` (Left (ExampleException "E") :: Either ExampleException [Int])
379− oneLevelNestedSum "asStream" asStream
380− oneLevelNestedSum "asCostream" asCostream
381− oneLevelNestedSum "asParAhead" asParAhead
382− oneLevelNestedSum "asCoparAhead" asCoparAhead
379+ oneLevelNestedSum "serially" serially
380+ oneLevelNestedSum "wSerially" wSerially
381+ oneLevelNestedSum "asyncly" asyncly
382+ oneLevelNestedSum "wAsyncly" wAsyncly
383383 -- XXX add two level nesting
384384
385− oneLevelNestedProduct "asStream" asStream
386− oneLevelNestedProduct "asCostream" asCostream
387− oneLevelNestedProduct "asParAhead" asParAhead
388− oneLevelNestedProduct "asCoparAhead" asCoparAhead
385+ oneLevelNestedProduct "serially" serially
386+ oneLevelNestedProduct "wSerially" wSerially
387+ oneLevelNestedProduct "asyncly" asyncly
388+ oneLevelNestedProduct "wAsyncly" wAsyncly
389389
390390 where
391391 tl = A.toList . t
@@ -414,7 +414,7 @@ _composeWithMonadError
414414 , Semigroup (t (ExceptT String IO) Int)
415415 , MonadError String (t (ExceptT String IO))
416416 )
417− => (t (ExceptT String IO) Int -> StreamT (ExceptT String IO) Int) -> Spec
417+ => (t (ExceptT String IO) Int -> SerialT (ExceptT String IO) Int) -> Spec
418418_composeWithMonadError t = do
419419 let tl = A.toList . t
420420 it "Compose throwError, nil" $
@@ -478,7 +478,7 @@ nestTwoCoparAhead :: Expectation
478478nestTwoCoparAhead =
479479 let s1 = foldMapWith (<>) return [1..4]
480480 s2 = foldMapWith (<>) return [5..8]
481− in ((A.toList . asCoparAhead) (do
481+ in ((A.toList . wAsyncly) (do
482482 x <- s1
483483 y <- s2
484484 return (x + y)
@@ -489,7 +489,7 @@ nestTwoParallel :: Expectation
489489nestTwoParallel =
490490 let s1 = foldMapWith (<>) return [1..4]
491491 s2 = foldMapWith (<>) return [5..8]
492− in ((A.toList . asParallel) (do
492+ in ((A.toList . parallely) (do
493493 x <- s1
494494 y <- s2
495495 return (x + y)
@@ -500,21 +500,21 @@ nestTwoCoparAheadApp :: Expectation
500500nestTwoCoparAheadApp =
501501 let s1 = foldMapWith (<>) return [1..4]
502502 s2 = foldMapWith (<>) return [5..8]
503− in ((A.toList . asCoparAhead) ((+) <$> s1 <*> s2) >>= return . sort)
503+ in ((A.toList . wAsyncly) ((+) <$> s1 <*> s2) >>= return . sort)
504504 `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
505505
506506nestTwoParallelApp :: Expectation
507507nestTwoParallelApp =
508508 let s1 = foldMapWith (<>) return [1..4]
509509 s2 = foldMapWith (<>) return [5..8]
510− in ((A.toList . asParallel) ((+) <$> s1 <*> s2) >>= return . sort)
510+ in ((A.toList . parallely) ((+) <$> s1 <*> s2) >>= return . sort)
511511 `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
512512
513513timed :: (IsStream t, Monad (t IO)) => Int -> t IO Int
514514timed x = A.once (threadDelay (x * 100000)) >> return x
515515
516516interleaveCheck :: IsStream t
517− => (t IO Int -> StreamT IO Int)
517+ => (t IO Int -> SerialT IO Int)
518518 -> (t IO Int -> t IO Int -> t IO Int)
519519 -> Spec
520520interleaveCheck t f =
@@ -523,7 +523,7 @@ interleaveCheck t f =
523523 `shouldReturn` ([0, 100, 1, 101])
524524
525525parallelCheck :: (IsStream t, Monad (t IO))
526− => (t IO Int -> StreamT IO Int)
526+ => (t IO Int -> SerialT IO Int)
527527 -> (t IO Int -> t IO Int -> t IO Int)
528528 -> Spec
529529parallelCheck t f = do
@@ -538,7 +538,7 @@ parallelCheck t f = do
538538 where event n = (A.once $ threadDelay (n * 100000)) >> (return n)
539539
540540compose :: (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
542542compose t z srt = do
543543 -- XXX these should get covered by the property tests
544544 it "Compose mempty, mempty" $
@@ -577,7 +577,7 @@ composeAndComposeSimple
577577 , Semigroup (t2 IO Int)
578578#endif
579579 )
580− => (t1 IO Int -> StreamT IO Int)
580+ => (t1 IO Int -> SerialT IO Int)
581581 -> (t2 IO Int -> t2 IO Int)
582582 -> [[Int]] -> Spec
583583composeAndComposeSimple t1 t2 answer = do
@@ -625,7 +625,7 @@ loops t tsrt hsrt = do
625625
626626bindAndComposeSimple
627627 :: ( 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)
629629 -> (t2 IO Int -> t2 IO Int)
630630 -> Spec
631631bindAndComposeSimple t1 t2 = do
@@ -642,7 +642,7 @@ bindAndComposeSimple t1 t2 = do
642642bindAndComposeHierarchy
643643 :: ( IsStream t1, Monad (t1 IO)
644644 , IsStream t2, Monad (t2 IO))
645− => (t1 IO Int -> StreamT IO Int)
645+ => (t1 IO Int -> SerialT IO Int)
646646 -> (t2 IO Int -> t2 IO Int)
647647 -> ([t2 IO Int] -> t2 IO Int)
648648 -> Spec
@@ -659,7 +659,7 @@ bindAndComposeHierarchy t1 t2 g = do
659659
660660 where
661661
662− -- bindComposeNested :: ACoparAheadT IO Int
662+ -- bindComposeNested :: WAsyncT IO Int
663663 bindComposeNested =
664664 let c1 = tripleCompose (return 1) (return 2) (return 3)
665665 c2 = tripleCompose (return 4) (return 5) (return 6)
@@ -686,21 +686,21 @@ mixedOps = do
686686 ] :: [Int])
687687 where
688688
689− composeMixed :: StreamT IO Int
689+ composeMixed :: SerialT IO Int
690690 composeMixed = do
691691 A.once $ return ()
692692 A.once $ putStr ""
693693 x <- return 1
694694 y <- return 2
695695 z <- do
696− x1 <- asCoparAhead $ return 1 <> return 2
696+ x1 <- wAsyncly $ return 1 <> return 2
697697 A.once $ return ()
698698 A.once $ putStr ""
699− y1 <- asParAhead $ return 1 <> return 2
699+ y1 <- asyncly $ return 1 <> return 2
700700 z1 <- do
701701 x11 <- return 1 <> return 2
702− y11 <- asParAhead $ return 1 <> return 2
703− z11 <- asCostream $ return 1 <> return 2
702+ y11 <- asyncly $ return 1 <> return 2
703+ z11 <- wSerially $ return 1 <> return 2
704704 A.once $ return ()
705705 A.once $ putStr ""
706706 return (x11 + y11 + z11)