on master help sign in
Rename Streamly.Prelude.yieldM to fromEffect.

- Deprecate yieldM.

commit70faf014ca95572645b1a2c6f5c3aff1a11454f2 authorPranay Sashank <pranaysashank@composewell.com> dateSat 29 May 2021, 02:05 (5 years ago) parent4dfc6bf
26 files changed+139−126
Changelog.md+1 benchmark/Streamly/Benchmark/Data/Stream/StreamDK.hs+1−1 benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs+2−2 benchmark/Streamly/Benchmark/Prelude/Serial/Exceptions.hs+1−1 benchmark/lib/Streamly/Benchmark/Prelude.hs+3−3 docs/Overview.md+3−3 docs/streamly-vs-async.md+3−3 src/Streamly/Internal/Data/Stream/Ahead.hs+7−7 src/Streamly/Internal/Data/Stream/Async.hs+10−10 src/Streamly/Internal/Data/Stream/IsStream/Common.hs+22−12 src/Streamly/Internal/Data/Stream/IsStream/Expand.hs+4−4 src/Streamly/Internal/Data/Stream/IsStream/Generate.hs+4−3 src/Streamly/Internal/Data/Stream/Parallel.hs+2−2 src/Streamly/Internal/Data/Stream/StreamD/Generate.hs+1−1 src/Streamly/Internal/Data/Stream/StreamD/Type.hs+6−6 src/Streamly/Internal/Data/Stream/StreamK.hs+4−4 src/Streamly/Internal/Data/Stream/StreamK/Type.hs+8−8 src/Streamly/Internal/Network/Inet/TCP.hs+1−1 src/Streamly/Prelude.hs+2−1 src/Streamly/Tutorial.hs+13−13 test/Streamly/Test/FileSystem/Event.hs+3−3 test/Streamly/Test/Prelude.hs+21−21 test/Streamly/Test/Prelude/Concurrent.hs+5−5 test/Streamly/Test/Prelude/Serial.hs+3−3 test/Streamly/Test/Prelude/WAsync.hs+1−1 test/lib/Streamly/Test/Prelude/Common.hs+8−8
Changelog.md+1
@@ -93,6 +93,7 @@
9393* In `Streamly.Prelude` the following functions have been renamed:
9494 * `concatUnfold` to `unfoldMany`
9595 * `yield` to `fromPure`
96+ * `yieldM` to `fromEffect`
9697* The following encoding/decoding routines have been renamed:
9798 * `encodeUtf8Lax` to `encodeUtf8`
9899 * `encodeLatin1Lax` to `encodeLatin1`
benchmark/Streamly/Benchmark/Data/Stream/StreamDK.hs+1−1
@@ -108,7 +108,7 @@ sourceFoldMapWith n = SP.foldMapWith S.serial S.fromPure [n..n+value]
108108
109109{-# INLINE sourceFoldMapWithM #-}
110110sourceFoldMapWithM :: Monad m => Int -> Stream m Int
111−sourceFoldMapWithM n = SP.foldMapWith S.serial (S.yieldM . return) [n..n+value]
111+sourceFoldMapWithM n = SP.foldMapWith S.serial (S.fromEffect . return) [n..n+value]
112112-}
113113
114114-------------------------------------------------------------------------------
benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs+2−2
@@ -159,7 +159,7 @@ concatMapFoldableSerial streamLen n = concatMapFoldableWith S.serial S.fromPure
159159{-# INLINE concatMapFoldableSerialM #-}
160160concatMapFoldableSerialM :: Monad m => Int -> Int -> Stream m Int
161161concatMapFoldableSerialM streamLen n =
162− concatMapFoldableWith S.serial (S.yieldM . return) [n..n+streamLen]
162+ concatMapFoldableWith S.serial (S.fromEffect . return) [n..n+streamLen]
163163
164164-------------------------------------------------------------------------------
165165-- Elimination
@@ -446,7 +446,7 @@ inspect $ hasNoTypeClasses 'concatMapRepl
446446sourceConcatMapId :: Monad m
447447 => Int -> Int -> Stream m (Stream m Int)
448448sourceConcatMapId val n =
449− S.fromFoldable $ fmap (S.yieldM . return) [n..n+val]
449+ S.fromFoldable $ fmap (S.fromEffect . return) [n..n+val]
450450
451451{-# INLINE concatMapBySerial #-}
452452concatMapBySerial :: Int -> Int -> Int -> IO ()
benchmark/Streamly/Benchmark/Prelude/Serial/Exceptions.hs+1−1
@@ -51,7 +51,7 @@ readWriteOnExceptionStream inh devNull =
5151-- | Send the file contents to /dev/null with exception handling
5252readWriteHandleExceptionStream :: Handle -> Handle -> IO ()
5353readWriteHandleExceptionStream inh devNull =
54− let handler (_e :: SomeException) = S.yieldM (hClose inh >> return 10)
54+ let handler (_e :: SomeException) = S.fromEffect (hClose inh >> return 10)
5555 readEx = S.handle handler (S.unfold FH.read inh)
5656 in S.fold (FH.write devNull) $ readEx
5757
benchmark/lib/Streamly/Benchmark/Prelude.hs+3−3
@@ -323,12 +323,12 @@ sourceFoldMapWithStream value n = S.concatMapFoldableWith (<>) S.fromPure
323323sourceFoldMapWithM :: (S.IsStream t, Monad m, Semigroup (t m Int))
324324 => Int -> Int -> t m Int
325325sourceFoldMapWithM value n =
326− S.concatMapFoldableWith (<>) (S.yieldM . return) [n..n+value]
326+ S.concatMapFoldableWith (<>) (S.fromEffect . return) [n..n+value]
327327
328328{-# INLINE sourceFoldMapM #-}
329329sourceFoldMapM :: (S.IsStream t, Monad m, Monoid (t m Int))
330330 => Int -> Int -> t m Int
331−sourceFoldMapM value n = F.foldMap (S.yieldM . return) [n..n+value]
331+sourceFoldMapM value n = F.foldMap (S.fromEffect . return) [n..n+value]
332332
333333-------------------------------------------------------------------------------
334334-- Concat
@@ -338,7 +338,7 @@ sourceFoldMapM value n = F.foldMap (S.yieldM . return) [n..n+value]
338338sourceConcatMapId :: (S.IsStream t, Monad m)
339339 => Int -> Int -> t m (t m Int)
340340sourceConcatMapId value n =
341− S.fromFoldable $ fmap (S.yieldM . return) [n..n+value]
341+ S.fromFoldable $ fmap (S.fromEffect . return) [n..n+value]
342342
343343-- concatMapWith
344344
docs/Overview.md+3−3
@@ -154,7 +154,7 @@ import qualified Streamly.Prelude as S
154154import Control.Concurrent (threadDelay)
155155
156156main = S.toList $ S.fromParallel $ foldMap delay [1..10]
157− where delay n = S.yieldM $ threadDelay (n * 1000000) >> print n
157+ where delay n = S.fromEffect $ threadDelay (n * 1000000) >> print n
158158```
159159
160160Streams can be combined together in many ways. We provide some examples
@@ -165,7 +165,7 @@ function in the examples to demonstrate the concurrency aspects:
165165import qualified Streamly.Prelude as S
166166import Control.Concurrent
167167
168−delay n = S.yieldM $ do
168+delay n = S.fromEffect $ do
169169 threadDelay (n * 1000000)
170170 tid <- myThreadId
171171 putStrLn (show tid ++ ": Delay " ++ show n)
@@ -202,7 +202,7 @@ import qualified Streamly.Prelude as S
202202loops = do
203203 x <- S.fromFoldable [1,2]
204204 y <- S.fromFoldable [3,4]
205− S.yieldM $ putStrLn $ show (x, y)
205+ S.fromEffect $ putStrLn $ show (x, y)
206206
207207main = S.drain loops
208208```
docs/streamly-vs-async.md+3−3
@@ -30,7 +30,7 @@ monad.
3030
3131You can write all of your program in a streamly monad and use the full power of
3232the library. Streamly can be used as a direct replacement of the IO monad with
33−no loss of performance, and no change in code except using `liftIO` or `yieldM`
33+no loss of performance, and no change in code except using `liftIO` or `fromEffect`
3434to run any IO actions. Streamly IO monads (e.g. `SerialT IO`) are just a
3535generalization of the IO monad with non-deterministic composition of streams
3636added on top.
@@ -98,7 +98,7 @@ function:
9898
9999```haskell
100100 tuples <- S.toList $ fromZipAsync $
101− (,) <$> S.yieldM (getURLString 1) <*> S.yieldM (getURLText 2)
101+ (,) <$> S.fromEffect (getURLString 1) <*> S.fromEffect (getURLText 2)
102102```
103103
104104### race
@@ -166,7 +166,7 @@ You can map a monadic action to a `Foldable` container to convert it into a
166166stream and at the same time fold it:
167167
168168```haskell
169− urls <- S.toList $ fromAhead $ foldMap (S.yieldM . getURL) [1..3]
169+ urls <- S.toList $ fromAhead $ foldMap (S.fromEffect . getURL) [1..3]
170170```
171171
172172### replicateConcurrently
src/Streamly/Internal/Data/Stream/Ahead.hs+7−7
@@ -136,7 +136,7 @@ import Prelude hiding (map)
136136-- XXX It may be a good idea to increment sequence numbers for each yield,
137137-- currently a stream on the left side of the expression may yield many
138138-- elements with the same sequene number. We can then use the seq number to
139−-- enforce yieldMax and yieldLImit as well.
139+-- enforce fromEffectax and yieldLImit as well.
140140
141141-- Invariants:
142142--
@@ -620,8 +620,8 @@ infixr 6 `ahead`
620620-- are evaluated:
621621--
622622-- >>> import Streamly.Prelude (ahead)
623−-- >>> stream1 = Stream.yieldM (delay 4) :: SerialT IO Int
624−-- >>> stream2 = Stream.yieldM (delay 2) :: SerialT IO Int
623+-- >>> stream1 = Stream.fromEffect (delay 4) :: SerialT IO Int
624+-- >>> stream2 = Stream.fromEffect (delay 2) :: SerialT IO Int
625625-- >>> Stream.toList $ stream1 `ahead` stream2 :: IO [Int]
626626-- 2 sec
627627-- 4 sec
@@ -630,7 +630,7 @@ infixr 6 `ahead`
630630-- Multiple streams can be combined. With enough threads, all of them can be
631631-- scheduled simultaneously:
632632--
633−-- >>> stream3 = Stream.yieldM (delay 1)
633+-- >>> stream3 = Stream.fromEffect (delay 1)
634634-- >>> Stream.toList $ stream1 `ahead` stream2 `ahead` stream3
635635-- 1 sec
636636-- 2 sec
@@ -674,7 +674,7 @@ ahead m1 m2 = mkStream $ \st yld sng stp ->
674674{-# INLINE consMAhead #-}
675675{-# SPECIALIZE consMAhead :: IO a -> AheadT IO a -> AheadT IO a #-}
676676consMAhead :: MonadAsync m => m a -> AheadT m a -> AheadT m a
677−consMAhead m r = fromStream $ K.yieldM m `ahead` (toStream r)
677+consMAhead m r = fromStream $ K.fromEffect m `ahead` (toStream r)
678678
679679------------------------------------------------------------------------------
680680-- AheadT
@@ -694,7 +694,7 @@ consMAhead m r = fromStream $ K.yieldM m `ahead` (toStream r)
694694-- >>> :{
695695-- Stream.toList $ Stream.fromAhead $ do
696696-- x <- Stream.fromList [2,1] -- foreach x in stream
697−-- Stream.yieldM $ delay x
697+-- Stream.fromEffect $ delay x
698698-- :}
699699-- 1 sec
700700-- 2 sec
@@ -707,7 +707,7 @@ consMAhead m r = fromStream $ K.yieldM m `ahead` (toStream r)
707707-- Stream.toList $ Stream.fromAhead $ do
708708-- x <- Stream.fromList [1,2] -- foreach x in stream
709709-- y <- Stream.fromList [2,4] -- foreach y in stream
710−-- Stream.yieldM $ delay (x + y)
710+-- Stream.fromEffect $ delay (x + y)
711711-- :}
712712-- 3 sec
713713-- 4 sec
src/Streamly/Internal/Data/Stream/Async.hs+10−10
@@ -657,8 +657,8 @@ infixr 6 `async`
657657-- outputs from both are used as they arrive:
658658--
659659-- >>> import Streamly.Prelude (async)
660−-- >>> stream1 = Stream.yieldM (delay 4)
661−-- >>> stream2 = Stream.yieldM (delay 2)
660+-- >>> stream1 = Stream.fromEffect (delay 4)
661+-- >>> stream2 = Stream.fromEffect (delay 2)
662662-- >>> Stream.toList $ stream1 `async` stream2
663663-- 2 sec
664664-- 4 sec
@@ -667,7 +667,7 @@ infixr 6 `async`
667667-- Multiple streams can be combined. With enough threads, all of them can be
668668-- scheduled simultaneously:
669669--
670−-- >>> stream3 = Stream.yieldM (delay 1)
670+-- >>> stream3 = Stream.fromEffect (delay 1)
671671-- >>> Stream.toList $ stream1 `async` stream2 `async` stream3
672672-- ...
673673-- [1,2,4]
@@ -735,7 +735,7 @@ async = joinStreamVarAsync AsyncVar
735735{-# INLINE consMAsync #-}
736736{-# SPECIALIZE consMAsync :: IO a -> AsyncT IO a -> AsyncT IO a #-}
737737consMAsync :: MonadAsync m => m a -> AsyncT m a -> AsyncT m a
738−consMAsync m r = fromStream $ K.yieldM m `async` (toStream r)
738+consMAsync m r = fromStream $ K.fromEffect m `async` (toStream r)
739739
740740------------------------------------------------------------------------------
741741-- AsyncT
@@ -755,7 +755,7 @@ consMAsync m r = fromStream $ K.yieldM m `async` (toStream r)
755755-- >>> :{
756756-- Stream.toList $ Stream.fromAsync $ do
757757-- x <- Stream.fromList [2,1] -- foreach x in stream
758−-- Stream.yieldM $ delay x
758+-- Stream.fromEffect $ delay x
759759-- :}
760760-- 1 sec
761761-- 2 sec
@@ -768,7 +768,7 @@ consMAsync m r = fromStream $ K.yieldM m `async` (toStream r)
768768-- Stream.toList $ Stream.fromAsync $ do
769769-- x <- Stream.fromList [1,2] -- foreach x in stream
770770-- y <- Stream.fromList [2,4] -- foreach y in stream
771−-- Stream.yieldM $ delay (x + y)
771+-- Stream.fromEffect $ delay (x + y)
772772-- :}
773773-- 3 sec
774774-- 4 sec
@@ -880,7 +880,7 @@ MONAD_COMMON_INSTANCES(AsyncT, MONADPARALLEL)
880880{-# INLINE consMWAsync #-}
881881{-# SPECIALIZE consMWAsync :: IO a -> WAsyncT IO a -> WAsyncT IO a #-}
882882consMWAsync :: MonadAsync m => m a -> WAsyncT m a -> WAsyncT m a
883−consMWAsync m r = fromStream $ K.yieldM m `wAsync` (toStream r)
883+consMWAsync m r = fromStream $ K.fromEffect m `wAsync` (toStream r)
884884
885885infixr 6 `wAsync`
886886
@@ -968,7 +968,7 @@ wAsync = joinStreamVarAsync WAsyncVar
968968-- >>> :{
969969-- Stream.toList $ Stream.fromWAsync $ do
970970-- x <- Stream.fromList [2,1] -- foreach x in stream
971−-- Stream.yieldM $ delay x
971+-- Stream.fromEffect $ delay x
972972-- :}
973973-- 1 sec
974974-- 2 sec
@@ -981,7 +981,7 @@ wAsync = joinStreamVarAsync WAsyncVar
981981-- Stream.toList $ Stream.fromWAsync $ do
982982-- x <- Stream.fromList [1,2] -- foreach x in stream
983983-- y <- Stream.fromList [2,4] -- foreach y in stream
984−-- Stream.yieldM $ delay (x + y)
984+-- Stream.fromEffect $ delay (x + y)
985985-- :}
986986-- 3 sec
987987-- 4 sec
@@ -1071,7 +1071,7 @@ wAsync = joinStreamVarAsync WAsyncVar
10711071-- @
10721072-- main = S.'drain' . S.'fromWAsync' $ do
10731073-- n <- return 3 \<\> return 2 \<\> return 1
1074−-- S.yieldM $ do
1074+-- S.fromEffect $ do
10751075-- threadDelay (n * 1000000)
10761076-- myThreadId >>= \\tid -> putStrLn (show tid ++ ": Delay " ++ show n)
10771077-- @
src/Streamly/Internal/Data/Stream/IsStream/Common.hs+22−12
@@ -15,7 +15,7 @@ module Streamly.Internal.Data.Stream.IsStream.Common
1515 (
1616 -- * Generation
1717 fromPure
18− , yieldM
18+ , fromEffect
1919 , repeatM
2020 , timesWith
2121 , absTimesWith
@@ -47,6 +47,7 @@ module Streamly.Internal.Data.Stream.IsStream.Common
4747
4848 -- * Deprecated
4949 , yield
50+ , yieldM
5051 )
5152where
5253
@@ -91,7 +92,7 @@ import Prelude hiding (take, takeWhile, drop, reverse, concatMap)
9192-- Generation
9293------------------------------------------------------------------------------
9394
94−-- Faster than yieldM because there is no bind.
95+-- Faster than fromEffect because there is no bind.
9596--
9697-- |
9798-- @
@@ -104,7 +105,7 @@ import Prelude hiding (take, takeWhile, drop, reverse, concatMap)
104105--
105106-- @
106107-- fromPure = pure
107−-- fromPure = yieldM . pure
108+-- fromPure = fromEffect . pure
108109-- @
109110--
110111-- In Zip applicative streams 'fromPure' is not the same as 'pure' because in that
@@ -120,26 +121,27 @@ fromPure = K.fromPure
120121
121122-- |
122123-- @
123−-- yieldM m = m \`consM` nil
124+-- fromEffect m = m \`consM` nil
124125-- @
125126--
126127-- Create a singleton stream from a monadic action.
127128--
128129-- @
129−-- > Stream.toList $ Stream.yieldM getLine
130+-- > Stream.toList $ Stream.fromEffect getLine
130131-- hello
131132-- ["hello"]
132133-- @
133134--
134−-- @since 0.4.0
135−{-# INLINE yieldM #-}
136−yieldM :: (Monad m, IsStream t) => m a -> t m a
137−yieldM = K.yieldM
135+-- /Since: 0.8.0 (Renamed yieldM to fromEffect)/
136+--
137+{-# INLINE fromEffect #-}
138+fromEffect :: (Monad m, IsStream t) => m a -> t m a
139+fromEffect = K.fromEffect
138140
139141-- |
140142-- @
141143-- repeatM = fix . consM
142−-- repeatM = cycle1 . yieldM
144+-- repeatM = cycle1 . fromEffect
143145-- @
144146--
145147-- Generate a stream by repeatedly executing a monadic action forever.
@@ -477,7 +479,7 @@ concatMap f m = fromStreamD $ D.concatMap (toStreamD . f) (toStreamD m)
477479-- monad with the stream monad.
478480--
479481-- @
480−-- concatM = concat . yieldM
482+-- concatM = concat . fromEffect
481483-- concatM = concat . lift -- requires @(MonadTrans t)@
482484-- concatM = join . lift -- requires @(MonadTrans t@, @Monad (t m))@
483485-- @
@@ -550,10 +552,18 @@ splitOnSeq
550552 => Array a -> Fold m a b -> t m a -> t m b
551553splitOnSeq patt f m = D.fromStreamD $ D.splitOnSeq patt f (D.toStreamD m)
552554
553−-- | Same as 'yield'
555+-- | Same as 'fromPure'
554556--
555557-- @since 0.4.0
556558{-# DEPRECATED yield "Please use fromPure instead." #-}
557559{-# INLINE yield #-}
558560yield :: IsStream t => a -> t m a
559561yield = fromPure
562+
563+-- | Same as 'fromEffect'
564+--
565+-- @since 0.4.0
566+{-# DEPRECATED yieldM "Please use fromEffect instead." #-}
567+{-# INLINE yieldM #-}
568+yieldM :: (Monad m, IsStream t) => m a -> t m a
569+yieldM = fromEffect
src/Streamly/Internal/Data/Stream/IsStream/Expand.hs+4−4
@@ -161,7 +161,7 @@ where
161161import Streamly.Internal.Data.Stream.Ahead (ahead)
162162import Streamly.Internal.Data.Stream.Async (async, wAsync)
163163import Streamly.Internal.Data.Stream.IsStream.Common
164− (concatM, concatMapM, concatMap, smapM, fromPure, yieldM)
164+ (concatM, concatMapM, concatMap, smapM, fromPure, fromEffect)
165165import Streamly.Internal.Data.Stream.Parallel (parallel)
166166import Streamly.Internal.Data.Stream.Prelude
167167 ( concatFoldableWith, concatMapFoldableWith
@@ -714,7 +714,7 @@ concatPairsWith = K.concatPairsWith
714714-- Note that 'iterateM' is a special case of 'iterateMapWith':
715715--
716716-- @
717−-- iterateM f = iterateMapWith serial (yieldM . f) . yieldM
717+-- iterateM f = iterateMapWith serial (fromEffect . f) . fromEffect
718718-- @
719719--
720720-- It can be used to traverse a tree structure. For example, to list a
@@ -774,7 +774,7 @@ iterateSmapMWith
774774 -> t m a
775775 -> t m a
776776iterateSmapMWith combine f initial stream =
777− concatMap (\b -> concatMapWith combine (go b) stream) (yieldM initial)
777+ concatMap (\b -> concatMapWith combine (go b) stream) (fromEffect initial)
778778
779779 where
780780
@@ -783,7 +783,7 @@ iterateSmapMWith combine f initial stream =
783783 feedback b a =
784784 concatMap
785785 (\(b1, s) -> concatMapWith combine (go b1) s)
786− (yieldM $ f b a)
786+ (fromEffect $ f b a)
787787
788788------------------------------------------------------------------------------
789789-- iterateMap - Either streams
src/Streamly/Internal/Data/Stream/IsStream/Generate.hs+4−3
@@ -36,7 +36,7 @@ module Streamly.Internal.Data.Stream.IsStream.Generate
3636
3737 -- * From Values
3838 , fromPure
39− , yieldM
39+ , fromEffect
4040 , repeat
4141 , repeatM
4242 , replicate
@@ -80,6 +80,7 @@ module Streamly.Internal.Data.Stream.IsStream.Generate
8080 -- * Deprecated
8181 , K.once
8282 , yield
83+ , yieldM
8384 , each
8485 , fromHandle
8586 , currentTime
@@ -95,8 +96,8 @@ import Streamly.Internal.Data.SVar (MonadAsync, Rate (..))
9596import Streamly.Internal.Data.Stream.IsStream.Enumeration
9697 (Enumerable(..), enumerate, enumerateTo)
9798import Streamly.Internal.Data.Stream.IsStream.Common
98− ( absTimesWith, concatM, relTimesWith, timesWith, fromPure, yield, yieldM
99− , repeatM)
99+ ( absTimesWith, concatM, relTimesWith, timesWith, fromPure, fromEffect
100+ , yield, yieldM, repeatM)
100101import Streamly.Internal.Data.Stream.Prelude (fromStreamS)
101102import Streamly.Internal.Data.Stream.StreamD (fromStreamD)
102103import Streamly.Internal.Data.Stream.StreamK (IsStream((|:), consM))
src/Streamly/Internal/Data/Stream/Parallel.hs+2−2
@@ -231,7 +231,7 @@ joinStreamVarPar style ss m1 m2 = mkStream $ \st yld sng stp ->
231231{-# INLINE consMParallel #-}
232232{-# SPECIALIZE consMParallel :: IO a -> ParallelT IO a -> ParallelT IO a #-}
233233consMParallel :: MonadAsync m => m a -> ParallelT m a -> ParallelT m a
234−consMParallel m r = fromStream $ K.yieldM m `parallel` (toStream r)
234+consMParallel m r = fromStream $ K.fromEffect m `parallel` (toStream r)
235235
236236infixr 6 `parallel`
237237
@@ -243,7 +243,7 @@ infixr 6 `parallel`
243243-- Evaluation may block if the output buffer becomes full.
244244--
245245-- >>> import Streamly.Prelude (parallel)
246−-- >>> stream = Stream.yieldM (delay 2) `parallel` Stream.yieldM (delay 1)
246+-- >>> stream = Stream.fromEffect (delay 2) `parallel` Stream.fromEffect (delay 1)
247247-- >>> Stream.toList stream -- IO [Int]
248248-- 1 sec
249249-- 2 sec
src/Streamly/Internal/Data/Stream/StreamD/Generate.hs+1−1
@@ -39,7 +39,7 @@ module Streamly.Internal.Data.Stream.StreamD.Generate
3939
4040 -- * From Values
4141 , fromPure
42− , yieldM
42+ , fromEffect
4343 , repeat
4444 , repeatM
4545 , replicate
src/Streamly/Internal/Data/Stream/StreamD/Type.hs+6−6
@@ -31,7 +31,7 @@ module Streamly.Internal.Data.Stream.StreamD.Type
3131
3232 -- * From Values
3333 , fromPure
34− , yieldM
34+ , fromEffect
3535
3636 -- * From Containers
3737 , fromList
@@ -197,9 +197,9 @@ fromPure x = Stream (\_ s -> pure $ step undefined s) True
197197 step _ False = Stop
198198
199199-- | Create a singleton 'Stream' from a monadic action.
200−{-# INLINE_NORMAL yieldM #-}
201−yieldM :: Monad m => m a -> Stream m a
202−yieldM m = Stream step True
200+{-# INLINE_NORMAL fromEffect #-}
201+fromEffect :: Monad m => m a -> Stream m a
202+fromEffect m = Stream step True
203203 where
204204 {-# INLINE_LATE step #-}
205205 step _ True = m >>= \x -> return $ Yield x False
@@ -373,7 +373,7 @@ foldrS f final (Stream step state) = go SPEC state
373373 {-# INLINE_LATE go #-}
374374 go !_ st = do
375375 -- defState??
376− r <- yieldM $ step defState st
376+ r <- fromEffect $ step defState st
377377 case r of
378378 Yield x s -> f x (go SPEC s)
379379 Skip s -> go SPEC s
@@ -965,7 +965,7 @@ groupsOf2 n input (Fold2 fstep inject extract) (Stream step state) =
965965
966966instance MonadTrans Stream where
967967 {-# INLINE lift #-}
968− lift = yieldM
968+ lift = fromEffect
969969
970970instance (MonadThrow m) => MonadThrow (Stream m) where
971971 throwM = lift . throwM
src/Streamly/Internal/Data/Stream/StreamK.hs+4−4
@@ -62,7 +62,7 @@ module Streamly.Internal.Data.Stream.StreamK
6262
6363 -- ** Conversions
6464 , fromPure
65− , yieldM
65+ , fromEffect
6666 , fromFoldable
6767 , fromList
6868 , fromStreamK
@@ -261,13 +261,13 @@ unfoldrA = undefined
261261-- Special generation
262262-------------------------------------------------------------------------------
263263
264−-- | Same as yieldM
264+-- | Same as fromEffect
265265--
266266-- @since 0.2.0
267−{-# DEPRECATED once "Please use yieldM instead." #-}
267+{-# DEPRECATED once "Please use fromEffect instead." #-}
268268{-# INLINE once #-}
269269once :: (Monad m, IsStream t) => m a -> t m a
270−once = yieldM
270+once = fromEffect
271271
272272-- |
273273-- @
src/Streamly/Internal/Data/Stream/StreamK/Type.hs+8−8
@@ -54,7 +54,7 @@ module Streamly.Internal.Data.Stream.StreamK.Type
5454 , (.:)
5555 , consMStream
5656 , consMBy
57− , yieldM
57+ , fromEffect
5858 , fromPure
5959
6060 , nil
@@ -349,15 +349,15 @@ nilM m = mkStream $ \_ _ _ stp -> m >> stp
349349fromPure :: IsStream t => a -> t m a
350350fromPure a = mkStream $ \_ _ single _ -> single a
351351
352−{-# INLINE_NORMAL yieldM #-}
353−yieldM :: (Monad m, IsStream t) => m a -> t m a
354−yieldM m = fromStream $ mkStream $ \_ _ single _ -> m >>= single
352+{-# INLINE_NORMAL fromEffect #-}
353+fromEffect :: (Monad m, IsStream t) => m a -> t m a
354+fromEffect m = fromStream $ mkStream $ \_ _ single _ -> m >>= single
355355
356356-- XXX specialize to IO?
357357{-# INLINE consMBy #-}
358358consMBy :: (IsStream t, MonadAsync m) => (t m a -> t m a -> t m a)
359359 -> m a -> t m a -> t m a
360−consMBy f m r = (fromStream $ yieldM m) `f` r
360+consMBy f m r = (fromStream $ fromEffect m) `f` r
361361
362362------------------------------------------------------------------------------
363363-- Folding a stream
@@ -534,7 +534,7 @@ foldrSM = foldrSMWith foldStream
534534
535535-- {-# RULES "foldrSM/id" foldrSM consM nil = \x -> x #-}
536536{-# RULES "foldrSM/nil" forall k z. foldrSM k z nil = z #-}
537−{-# RULES "foldrSM/single" forall k z x. foldrSM k z (yieldM x) = k x z #-}
537+{-# RULES "foldrSM/single" forall k z x. foldrSM k z (fromEffect x) = k x z #-}
538538-- {-# RULES "foldrSM/app" [1]
539539-- forall ys. foldrSM consM ys = \xs -> xs `conjoin` ys #-}
540540
@@ -548,7 +548,7 @@ foldrSMShared = foldrSMWith foldStreamShared
548548{-# RULES "foldrSMShared/nil"
549549 forall k z. foldrSMShared k z nil = z #-}
550550{-# RULES "foldrSMShared/single"
551− forall k z x. foldrSMShared k z (yieldM x) = k x z #-}
551+ forall k z x. foldrSMShared k z (fromEffect x) = k x z #-}
552552-- {-# RULES "foldrSM/app" [1]
553553-- forall ys. foldrSM consM ys = \xs -> xs `conjoin` ys #-}
554554
@@ -933,7 +933,7 @@ instance Monad m => Functor (Stream m) where
933933
934934instance MonadTrans Stream where
935935 {-# INLINE lift #-}
936− lift = yieldM
936+ lift = fromEffect
937937
938938-------------------------------------------------------------------------------
939939-- Nesting
src/Streamly/Internal/Network/Inet/TCP.hs+1−1
@@ -340,7 +340,7 @@ putChunks
340340 -> SerialT m (Array Word8)
341341 -> m ()
342342putChunks addr port xs =
343− S.drain $ withConnection addr port (\sk -> S.yieldM $ ISK.putChunks sk xs)
343+ S.drain $ withConnection addr port (\sk -> S.fromEffect $ ISK.putChunks sk xs)
344344
345345-- | Write a stream of arrays to the supplied IPv4 host address and port
346346-- number.
src/Streamly/Prelude.hs+2−1
@@ -348,7 +348,7 @@ module Streamly.Prelude
348348 -- ** From Values
349349 -- | Generate a monadic stream from a seed value or values.
350350 , fromPure
351− , yieldM
351+ , fromEffect
352352 , repeat
353353 , repeatM
354354 , replicate
@@ -921,6 +921,7 @@ module Streamly.Prelude
921921 -- * Deprecated
922922 , once
923923 , yield
924+ , yieldM
924925 , each
925926 , scanx
926927 , foldx
src/Streamly/Tutorial.hs+13−13
@@ -192,7 +192,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
192192-- represents a single IO action whereas the 'Serial' monad represents a series
193193-- of IO actions. The only change you need to make to go from 'IO' to 'Serial'
194194-- is to use 'drain' to run the monad and to prefix the IO actions with
195−-- either 'yieldM' or 'liftIO'. If you use liftIO you can switch from 'Serial'
195+-- either 'fromEffect' or 'liftIO'. If you use liftIO you can switch from 'Serial'
196196-- to IO monad by simply removing the 'drain' function; no other changes
197197-- are needed unless you have used some stream specific composition or
198198-- combinators.
@@ -364,7 +364,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
364364-- @
365365--
366366-- To create a singleton stream from a pure value use 'fromPure' or 'pure' and to
367−-- create a singleton stream from a monadic action use 'yieldM'. Note that in
367+-- create a singleton stream from a monadic action use 'fromEffect'. Note that in
368368-- case of Zip applicative streams "pure" repeats the value to generate an
369369-- infinite stream.
370370--
@@ -373,7 +373,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
373373-- [1]
374374-- > S.'toList' $ S.'fromPure' 1
375375-- [1]
376−-- > S.'toList' $ S.'yieldM' 'getLine'
376+-- > S.'toList' $ S.'fromEffect' 'getLine'
377377-- hello
378378-- ["hello"]
379379-- @
@@ -529,7 +529,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
529529-- seconds. After the delay it prints the number of seconds it slept.
530530--
531531-- @
532−-- delay n = S.'yieldM' $ do
532+-- delay n = S.'fromEffect' $ do
533533-- threadDelay (n * 1000000)
534534-- tid \<- myThreadId
535535-- putStrLn (show tid ++ ": Delay " ++ show n)
@@ -760,7 +760,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
760760--
761761-- @
762762-- main = S.'drain' . S.'fromAsync' $ traced (sqrt 9) '<>' traced (sqrt 16) '<>' traced (sqrt 25)
763−-- where traced m = S.'yieldM' (myThreadId >>= print) >> return m
763+-- where traced m = S.'fromEffect' (myThreadId >>= print) >> return m
764764-- @
765765-- @
766766-- ThreadId 40
@@ -882,7 +882,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
882882-- google = get "https://www.google.com/search?q=haskell"
883883-- bing = get "https://www.bing.com/search?q=haskell"
884884-- duckduckgo = get "https://www.duckduckgo.com/?q=haskell"
885−-- get s = S.'yieldM' (httpNoBody (parseRequest_ s) >> putStrLn (show s))
885+-- get s = S.'fromEffect' (httpNoBody (parseRequest_ s) >> putStrLn (show s))
886886-- @
887887--
888888-- The polymorphic version of the binary operation '<>' of the 'Parallel' type
@@ -941,7 +941,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
941941-- S.'drain' $ S.'concatFoldableWith' S.'async' (map delay [1..10])
942942-- S.'drain' $ S.'concatMapFoldableWith' S.'async' delay [1..10]
943943-- S.'drain' $ S.'concatForFoldableWith' S.'async' [1..10] delay
944−-- where delay n = S.'yieldM' $ threadDelay (n * 1000000) >> print n
944+-- where delay n = S.'fromEffect' $ threadDelay (n * 1000000) >> print n
945945-- @
946946
947947-- $nesting
@@ -1011,7 +1011,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
10111011--
10121012-- import Control.Monad (forever)
10131013--
1014−-- main = S.'drain' $ forever $ S.'yieldM' getLine >>= S.'yieldM' . putStrLn
1014+-- main = S.'drain' $ forever $ S.'fromEffect' getLine >>= S.'fromEffect' . putStrLn
10151015-- @
10161016--
10171017-- When multiple streams are composed using this style they nest in a DFS
@@ -1025,7 +1025,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
10251025-- main = S.'drain' $ do
10261026-- x <- S.'fromFoldable' [1,2]
10271027-- y <- S.'fromFoldable' [3,4]
1028−-- S.'yieldM' $ putStrLn $ show (x, y)
1028+-- S.'fromEffect' $ putStrLn $ show (x, y)
10291029-- @
10301030-- @
10311031-- (1,3)
@@ -1119,7 +1119,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
11191119-- main = S.'drain' . S.'fromAsync' $ do
11201120-- x <- S.'fromFoldable' [1,2]
11211121-- y <- S.'fromFoldable' [3,4]
1122−-- S.'yieldM' $ putStrLn $ show (x, y)
1122+-- S.'fromEffect' $ putStrLn $ show (x, y)
11231123-- @
11241124-- @
11251125-- (1,3)
@@ -1143,7 +1143,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
11431143-- main = S.'drain' . S.'fromWSerial' $ do
11441144-- x <- S.'fromFoldable' [1,2]
11451145-- y <- S.'fromFoldable' [3,4]
1146−-- S.yieldM $ putStrLn $ show (x, y)
1146+-- S.fromEffect $ putStrLn $ show (x, y)
11471147-- @
11481148-- @
11491149-- (1,3)
@@ -1170,7 +1170,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
11701170-- main = S.'drain' . S.'fromWAsync' $ do
11711171-- x <- S.'fromFoldable' [1,2]
11721172-- y <- S.'fromFoldable' [3,4]
1173−-- S.'yieldM' $ putStrLn $ show (x, y)
1173+-- S.'fromEffect' $ putStrLn $ show (x, y)
11741174-- @
11751175-- @
11761176-- (1,3)
@@ -1217,7 +1217,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
12171217-- sz <- sizes
12181218-- cl <- colors
12191219-- sh <- shapes
1220−-- S.'yieldM' $ putStrLn $ show (sz, cl, sh)
1220+-- S.'fromEffect' $ putStrLn $ show (sz, cl, sh)
12211221--
12221222-- where
12231223--
test/Streamly/Test/FileSystem/Event.hs+3−3
@@ -154,9 +154,9 @@ checkEvents rootPath m matchList = do
154154checker :: S.IsStream t =>
155155 FilePath -> MVar () -> [String] -> t IO String
156156checker rootPath synch matchList =
157− S.yieldM (checkEvents rootPath synch matchList)
157+ S.fromEffect (checkEvents rootPath synch matchList)
158158 `S.parallelFst`
159− S.yieldM timeout
159+ S.fromEffect timeout
160160
161161-------------------------------------------------------------------------------
162162-- Test Drivers
@@ -178,7 +178,7 @@ driver (desc, pre, ops, events) = it desc $ runTest `shouldReturn` "PASS"
178178 withSystemTempDirectory fseventDir $ \fp -> do
179179 pre fp
180180 let eventStream = checker fp sync events
181− fsOps = S.yieldM $ runFSOps fp sync
181+ fsOps = S.fromEffect $ runFSOps fp sync
182182 fmap fromJust $ S.head $ eventStream `S.parallelFst` fsOps
183183
184184 runFSOps fp sync = do
test/Streamly/Test/Prelude.hs+21−21
@@ -77,21 +77,21 @@ mixedOps =
7777
7878 composeMixed :: SerialT IO Int
7979 composeMixed = do
80− S.yieldM $ return ()
81− S.yieldM $ putStr ""
80+ S.fromEffect $ return ()
81+ S.fromEffect $ putStr ""
8282 let x = 1
8383 let y = 2
8484 z <- do
8585 x1 <- S.fromWAsync $ return 1 <> return 2
86− S.yieldM $ return ()
87− S.yieldM $ putStr ""
86+ S.fromEffect $ return ()
87+ S.fromEffect $ putStr ""
8888 y1 <- S.fromAsync $ return 1 <> return 2
8989 z1 <- do
9090 x11 <- return 1 <> return 2
9191 y11 <- S.fromAsync $ return 1 <> return 2
9292 z11 <- S.fromWSerial $ return 1 <> return 2
93− S.yieldM $ return ()
94− S.yieldM $ putStr ""
93+ S.fromEffect $ return ()
94+ S.fromEffect $ putStr ""
9595 return (x11 + y11 + z11)
9696 return (x1 + y1 + z1)
9797 return (x + y + z)
@@ -107,21 +107,21 @@ mixedOpsAheadly =
107107
108108 composeMixed :: SerialT IO Int
109109 composeMixed = do
110− S.yieldM $ return ()
111− S.yieldM $ putStr ""
110+ S.fromEffect $ return ()
111+ S.fromEffect $ putStr ""
112112 let x = 1
113113 let y = 2
114114 z <- do
115115 x1 <- S.fromWAsync $ return 1 <> return 2
116− S.yieldM $ return ()
117− S.yieldM $ putStr ""
116+ S.fromEffect $ return ()
117+ S.fromEffect $ putStr ""
118118 y1 <- S.fromAhead $ return 1 <> return 2
119119 z1 <- do
120120 x11 <- return 1 <> return 2
121121 y11 <- S.fromAhead $ return 1 <> return 2
122122 z11 <- S.fromParallel $ return 1 <> return 2
123− S.yieldM $ return ()
124− S.yieldM $ putStr ""
123+ S.fromEffect $ return ()
124+ S.fromEffect $ putStr ""
125125 return (x11 + y11 + z11)
126126 return (x1 + y1 + z1)
127127 return (x + y + z)
@@ -129,20 +129,20 @@ mixedOpsAheadly =
129129-- XXX Merge both the loops.
130130nestedLoops :: IO ()
131131nestedLoops = S.drain $ do
132− S.yieldM $ hSetBuffering stdout LineBuffering
132+ S.fromEffect $ hSetBuffering stdout LineBuffering
133133 x <- loop "A " 2
134134 y <- loop "B " 2
135− S.yieldM $ myThreadId >>= putStr . show
135+ S.fromEffect $ myThreadId >>= putStr . show
136136 >> putStr " "
137137 >> print (x, y)
138138
139139 where
140140
141141 -- we can just use
142− -- fromParallel $ mconcat $ replicate n $ yieldM (...)
142+ -- fromParallel $ mconcat $ replicate n $ fromEffect (...)
143143 loop :: String -> Int -> SerialT IO String
144144 loop name n = do
145− rnd <- S.yieldM (randomIO :: IO Int)
145+ rnd <- S.fromEffect (randomIO :: IO Int)
146146 let result = name <> show rnd
147147 repeatIt = if n > 1 then loop name (n - 1) else S.nil
148148 in return result `S.wAsync` repeatIt
@@ -152,19 +152,19 @@ parallelLoops = do
152152 hSetBuffering stdout LineBuffering
153153 S.drain $ do
154154 x <- S.take 10 $ loop "A" `S.parallel` loop "B"
155− S.yieldM $ myThreadId >>= putStr . show
155+ S.fromEffect $ myThreadId >>= putStr . show
156156 >> putStr " got "
157157 >> print x
158158
159159 where
160160
161161 -- we can just use
162− -- fromParallel $ cycle1 $ yieldM (...)
162+ -- fromParallel $ cycle1 $ fromEffect (...)
163163 loop :: String -> SerialT IO (String, Int)
164164 loop name = do
165− S.yieldM $ threadDelay 1000000
166− rnd <- S.yieldM (randomIO :: IO Int)
167− S.yieldM $ myThreadId >>= putStr . show
165+ S.fromEffect $ threadDelay 1000000
166+ rnd <- S.fromEffect (randomIO :: IO Int)
167+ S.fromEffect $ myThreadId >>= putStr . show
168168 >> putStr " yielding "
169169 >> print rnd
170170 return (name, rnd) `S.parallel` loop name
test/Streamly/Test/Prelude/Concurrent.hs+5−5
@@ -129,10 +129,10 @@ concurrentUnfoldrM eq op n =
129129 -- results may not be yielded in order, in case of
130130 -- Async/WAsync/Parallel. So we use an increasing count
131131 -- instead.
132− i <- S.yieldM $ readIORef cnt
133− S.yieldM $ modifyIORef cnt (+1)
132+ i <- S.fromEffect $ readIORef cnt
133+ S.fromEffect $ modifyIORef cnt (+1)
134134 let msg = show i <> "/" <> show n
135− S.yieldM $
135+ S.fromEffect $
136136 when (even i) $ do
137137 dbgMVar ("first take concurrentUnfoldrM " <> msg)
138138 (takeMVar mv)
@@ -484,12 +484,12 @@ main = hspec
484484
485485 it "asyncly crosses thread limit (2000 threads)" $
486486 S.drain (fromAsync $ fold $
487− replicate 2000 $ S.yieldM $ threadDelay 1000000)
487+ replicate 2000 $ S.fromEffect $ threadDelay 1000000)
488488 `shouldReturn` ()
489489
490490 it "aheadly crosses thread limit (4000 threads)" $
491491 S.drain (fromAhead $ fold $
492− replicate 4000 $ S.yieldM $ threadDelay 1000000)
492+ replicate 4000 $ S.fromEffect $ threadDelay 1000000)
493493 `shouldReturn` ()
494494
495495#ifdef DEVBUILD
test/Streamly/Test/Prelude/Serial.hs+3−3
@@ -473,7 +473,7 @@ testFromCallback = do
473473 setCallback ref cb = do
474474 writeIORef ref (Just cb)
475475
476− runCallback ref = S.yieldM $ do
476+ runCallback ref = S.fromEffect $ do
477477 cb <-
478478 S.repeatM (readIORef ref)
479479 & IS.delayPost 0.1
@@ -526,7 +526,7 @@ main = hspec
526526 it "simple serially" $
527527 (S.drain . fromSerial) (return (0 :: Int)) `shouldReturn` ()
528528 it "simple serially with IO" $
529− (S.drain . fromSerial) (S.yieldM $ putStrLn "hello") `shouldReturn` ()
529+ (S.drain . fromSerial) (S.fromEffect $ putStrLn "hello") `shouldReturn` ()
530530
531531 describe "Empty" $
532532 it "Monoid - mempty" $
@@ -559,7 +559,7 @@ main = hspec
559559 serialOps $ prop "serially fromListM" . constructWithFromListM id
560560 serialOps $ prop "serially unfoldr" . constructWithUnfoldr id
561561 serialOps $ prop "serially fromPure" . constructWithYield id
562− serialOps $ prop "serially yieldM" . constructWithYieldM id
562+ serialOps $ prop "serially fromEffect" . constructWithFromEffect id
563563 serialOps $ prop "serially cons" . constructWithCons S.cons
564564 serialOps $ prop "serially consM" . constructWithConsM S.consM id
565565 serialOps $ prop "serially (.:)" . constructWithCons (S..:)
test/Streamly/Test/Prelude/WAsync.hs+1−1
@@ -122,7 +122,7 @@ main = hspec
122122
123123#ifdef DEVBUILD
124124 let timed :: (IsStream t, Monad (t IO)) => Int -> t IO Int
125− timed x = S.yieldM (threadDelay (x * 100000)) >> return x
125+ timed x = S.fromEffect (threadDelay (x * 100000)) >> return x
126126
127127 -- These are not run fromParallel because the timing gets affected
128128 -- unpredictably when other tests are running on the same machine.
test/lib/Streamly/Test/Prelude/Common.hs+8−8
@@ -30,7 +30,7 @@ module Streamly.Test.Prelude.Common
3030 , constructWithCons
3131 , constructWithConsM
3232 , constructWithYield
33− , constructWithYieldM
33+ , constructWithFromEffect
3434 , simpleOps
3535 -- * Applicative operations
3636 , applicativeOps
@@ -415,7 +415,7 @@ constructWithYield listT op len =
415415 let list = replicate (fromIntegral len) 0
416416 listEquals (==) (listT strm) list
417417
418−constructWithYieldM ::
418+constructWithFromEffect ::
419419 (IsStream t
420420#if __GLASGOW_HASKELL__ < 806
421421 , Monoid (t IO Int)
@@ -425,13 +425,13 @@ constructWithYieldM ::
425425 -> (t IO Int -> SerialT IO Int)
426426 -> Word8
427427 -> Property
428−constructWithYieldM listT op len =
428+constructWithFromEffect listT op len =
429429 withMaxSuccess maxTestCount $
430430 monadicIO $ do
431431 strm <-
432432 run
433433 $ S.toList . op . S.take (fromIntegral len)
434− $ foldMap S.yieldM (repeat (return 0))
434+ $ foldMap S.fromEffect (repeat (return 0))
435435 let list = replicate (fromIntegral len) 0
436436 listEquals (==) (listT strm) list
437437
@@ -447,7 +447,7 @@ simpleProps constr op a = monadicIO $ do
447447simpleOps :: IsStream t => (t IO Int -> SerialT IO Int) -> Spec
448448simpleOps op = do
449449 prop "fromPure a = a" $ simpleProps S.fromPure op
450− prop "yieldM a = a" $ simpleProps (S.yieldM . return) op
450+ prop "fromEffect a = a" $ simpleProps (S.fromEffect . return) op
451451
452452-------------------------------------------------------------------------------
453453-- Applicative operations
@@ -786,12 +786,12 @@ loops t tsrt hsrt = do
786786 where
787787 loopHead x = do
788788 -- this print line is important for the test (causes a bind)
789− S.yieldM $ putStrLn "LoopHead..."
789+ S.fromEffect $ putStrLn "LoopHead..."
790790 t $ (if x < 3 then loopHead (x + 1) else nil) <> return x
791791
792792 loopTail x = do
793793 -- this print line is important for the test (causes a bind)
794− S.yieldM $ putStrLn "LoopTail..."
794+ S.fromEffect $ putStrLn "LoopTail..."
795795 t $ return x <> (if x < 3 then loopTail (x + 1) else nil)
796796
797797---------------------------------------------------------------------------
@@ -1385,7 +1385,7 @@ parallelCheck t f = do
13851385 (S.toList . t) (event 4 `f` (event 3 `f` (event 2 `f` event 1)))
13861386 `shouldReturn` [1..4]
13871387
1388− where event n = S.yieldM (threadDelay (n * 200000)) >> return n
1388+ where event n = S.fromEffect (threadDelay (n * 200000)) >> return n
13891389
13901390-------------------------------------------------------------------------------
13911391-- Exception ops