@@ -370,13 +370,13 @@ module Streamly.Prelude
370 , insertBy
370 , insertBy
371 , intersperseM
371 , intersperseM
372 , intersperse
372 , intersperse
373− , insertAfterEach
373+ -- , insertAfterEach
374 -- , intersperseBySpan
374 -- , intersperseBySpan
375− , intersperseByTime
375+ -- , intersperseByTime
377 -- ** Reordering
377 -- ** Reordering
378 , reverse
378 , reverse
379− , reverse'
379+ -- , reverse'
381 -- * Multi-Stream Operations
381 -- * Multi-Stream Operations
382 -- | New streams can be constructed by appending, merging or zipping
382 -- | New streams can be constructed by appending, merging or zipping
@@ -815,7 +815,9 @@ iterate step = fromStream . go
816-- /Concurrent/
816-- /Concurrent/
818−-- @since 0.1.2
818+-- /Since: 0.7.0 (signature change)/
819iterateM :: (IsStream t, MonadAsync m) => (a -> m a) -> m a -> t m a
821iterateM :: (IsStream t, MonadAsync m) => (a -> m a) -> m a -> t m a
820iterateM step = go
822iterateM step = go
@@ -872,7 +874,7 @@ each = K.fromFoldable
872-- | Read lines from an IO Handle into a stream of Strings.
874-- | Read lines from an IO Handle into a stream of Strings.
874-- @since 0.1.0
876-- @since 0.1.0
875−{-# DEPRECATED fromHandle "Please use Streamly.FileIO instead." #-}
877+{-# DEPRECATED fromHandle "Please use Streamly.FileSystem.Handle instead." #-}
876fromHandle :: (IsStream t, MonadIO m) => IO.Handle -> t m String
878fromHandle :: (IsStream t, MonadIO m) => IO.Handle -> t m String
877fromHandle h = go
879fromHandle h = go
@@ -983,7 +985,11 @@ fromHandle h = go
983-- incrementally in FIFO style. Therefore, a strict left fold is more suitable
985-- incrementally in FIFO style. Therefore, a strict left fold is more suitable
984-- for reductions.
986-- for reductions.
986−-- @since 0.7.0
988+-- /Since: 0.7.0 (signature changed)/
990+-- /Since: 0.2.0 (signature changed)/
987{-# INLINE foldrM #-}
993{-# INLINE foldrM #-}
988foldrM :: Monad m => (a -> m b -> m b) -> m b -> SerialT m a -> m b
994foldrM :: Monad m => (a -> m b -> m b) -> m b -> SerialT m a -> m b
989foldrM = P.foldrM
995foldrM = P.foldrM
@@ -1209,11 +1215,16 @@ foldlM' step begin m = S.foldlM' step begin $ toStreamS m
1209-- as 'SerialT', to run other types of streams use the type adapting
1215-- as 'SerialT', to run other types of streams use the type adapting
1210-- combinators for example @drain . 'asyncly'@.
1216-- combinators for example @drain . 'asyncly'@.
1212−-- @since 0.2.0
1218+-- @since 0.7.0
1213{-# INLINE drain #-}
1219{-# INLINE drain #-}
1214drain :: Monad m => SerialT m a -> m ()
1220drain :: Monad m => SerialT m a -> m ()
1215drain = P.drain
1221drain = P.drain
1223+-- | Run a stream, discarding the results. By default it interprets the stream
1224+-- as 'SerialT', to run other types of streams use the type adapting
1225+-- combinators for example @runStream . 'asyncly'@.
1217{-# DEPRECATED runStream "Please use \"drain\" instead" #-}
1228{-# DEPRECATED runStream "Please use \"drain\" instead" #-}
1218{-# INLINE runStream #-}
1229{-# INLINE runStream #-}
1219runStream :: Monad m => SerialT m a -> m ()
1230runStream :: Monad m => SerialT m a -> m ()
@@ -1229,6 +1240,12 @@ runStream = drain
1229drainN :: Monad m => Int -> SerialT m a -> m ()
1240drainN :: Monad m => Int -> SerialT m a -> m ()
1230drainN n = drain . take n
1241drainN n = drain . take n
1244+-- > runN n = runStream . take n
1246+-- Run maximum up to @n@ iterations of a stream.
1232{-# DEPRECATED runN "Please use \"drainN\" instead" #-}
1249{-# DEPRECATED runN "Please use \"drainN\" instead" #-}
1233{-# INLINE runN #-}
1250{-# INLINE runN #-}
1234runN :: Monad m => Int -> SerialT m a -> m ()
1251runN :: Monad m => Int -> SerialT m a -> m ()
@@ -1239,11 +1256,17 @@ runN = drainN
1240-- Run a stream as long as the predicate holds true.
1257-- Run a stream as long as the predicate holds true.
1242−-- @since 0.6.0
1259+-- @since 0.7.0
1243{-# INLINE drainWhile #-}
1260{-# INLINE drainWhile #-}
1244drainWhile :: Monad m => (a -> Bool) -> SerialT m a -> m ()
1261drainWhile :: Monad m => (a -> Bool) -> SerialT m a -> m ()
1245drainWhile p = drain . takeWhile p
1262drainWhile p = drain . takeWhile p
1265+-- > runWhile p = runStream . takeWhile p
1267+-- Run a stream as long as the predicate holds true.
1247{-# DEPRECATED runWhile "Please use \"drainWhile\" instead" #-}
1270{-# DEPRECATED runWhile "Please use \"drainWhile\" instead" #-}
1248{-# INLINE runWhile #-}
1271{-# INLINE runWhile #-}
1249runWhile :: Monad m => (a -> Bool) -> SerialT m a -> m ()
1272runWhile :: Monad m => (a -> Bool) -> SerialT m a -> m ()
@@ -1566,7 +1589,7 @@ _toListRev = D.toListRev . toStreamD
1566-- Write a stream of Strings to an IO Handle.
1589-- Write a stream of Strings to an IO Handle.
1568-- @since 0.1.0
1591-- @since 0.1.0
1569−{-# DEPRECATED toHandle "Please use Streamly.FileIO instead." #-}
1592+{-# DEPRECATED toHandle "Please use Streamly.FileSystem.Handle instead." #-}
1570toHandle :: MonadIO m => IO.Handle -> SerialT m String -> m ()
1593toHandle :: MonadIO m => IO.Handle -> SerialT m String -> m ()
1571toHandle h m = go m
1594toHandle h m = go m
@@ -1604,7 +1627,9 @@ _transform pipe xs = fromStreamD $ D.transform pipe (toStreamD xs)
1604-- designed to work with the @foldl@ library. The suffix @x@ is a mnemonic for
1627-- designed to work with the @foldl@ library. The suffix @x@ is a mnemonic for
1605-- extraction.
1628-- extraction.
1607−-- @since 0.2.0
1630+-- /Since: 0.7.0 (Monad m constraint)/
1608{-# DEPRECATED scanx "Please use scanl followed by map instead." #-}
1633{-# DEPRECATED scanx "Please use scanl followed by map instead." #-}
1609{-# INLINE scanx #-}
1634{-# INLINE scanx #-}
1610scanx :: (IsStream t, Monad m) => (x -> a -> x) -> x -> (x -> b) -> t m a -> t m b
1635scanx :: (IsStream t, Monad m) => (x -> a -> x) -> x -> (x -> b) -> t m a -> t m b
@@ -1911,7 +1936,9 @@ mapMaybeMSerial f m = fromStreamD $ D.mapMaybeM f $ toStreamD m
1911-- /Note:/ 'reverse'' is much faster than this, use that when performance
1936-- /Note:/ 'reverse'' is much faster than this, use that when performance
1912-- matters.
1937-- matters.
1914−-- @since 0.1.1
1939+-- /Since 0.7.0 (Monad m constraint)/
1915{-# INLINE reverse #-}
1942{-# INLINE reverse #-}
1916reverse :: (IsStream t, Monad m) => t m a -> t m a
1943reverse :: (IsStream t, Monad m) => t m a -> t m a
1917reverse s = fromStreamS $ S.reverse $ toStreamS s
1944reverse s = fromStreamS $ S.reverse $ toStreamS s
@@ -1919,9 +1946,9 @@ reverse s = fromStreamS $ S.reverse $ toStreamS s
1919-- | Like 'reverse' but several times faster, requires a 'Storable' instance.
1946-- | Like 'reverse' but several times faster, requires a 'Storable' instance.
1921-- @since 0.7.0
1948-- @since 0.7.0
1922−{-# INLINE reverse' #-}
1949+{-# INLINE _reverse' #-}
1923−reverse' :: (IsStream t, MonadIO m, Storable a) => t m a -> t m a
1950+_reverse' :: (IsStream t, MonadIO m, Storable a) => t m a -> t m a
1924−reverse' s = fromStreamD $ D.reverse' $ toStreamD s
1951+_reverse' s = fromStreamD $ D.reverse' $ toStreamD s
1926------------------------------------------------------------------------------
1953------------------------------------------------------------------------------
1927-- Transformation by Inserting
1954-- Transformation by Inserting
@@ -1960,9 +1987,9 @@ intersperse a = fromStreamS . S.intersperse a . toStreamS
1960-- | Insert a monadic action after each element in the stream.
1987-- | Insert a monadic action after each element in the stream.
1962-- @since 0.7.0
1989-- @since 0.7.0
1963−{-# INLINE insertAfterEach #-}
1990+{-# INLINE _insertAfterEach #-}
1964−insertAfterEach :: (IsStream t, MonadAsync m) => m a -> t m a -> t m a
1991+_insertAfterEach :: (IsStream t, MonadAsync m) => m a -> t m a -> t m a
1965−insertAfterEach m = fromStreamD . D.insertAfterEach m . toStreamD
1992+_insertAfterEach m = fromStreamD . D.insertAfterEach m . toStreamD
1968-- | Intersperse a monadic action into the input stream after every @n@
1995-- | Intersperse a monadic action into the input stream after every @n@
@@ -1988,11 +2015,11 @@ intersperseBySpan _n _f _xs = undefined
1990-- @since 0.7.0
2017-- @since 0.7.0
1991−{-# INLINE intersperseByTime #-}
2018+{-# INLINE _intersperseByTime #-}
1992−intersperseByTime
2019+_intersperseByTime
1993 :: (IsStream t, MonadAsync m)
2020 :: (IsStream t, MonadAsync m)
1994 => Double -> m a -> t m a -> t m a
2021 => Double -> m a -> t m a -> t m a
1995−intersperseByTime n f xs = xs `Par.parallelEndByFirst` repeatM timed
2022+_intersperseByTime n f xs = xs `Par.parallelEndByFirst` repeatM timed
1996 where timed = liftIO (threadDelay (round $ n * 1000000)) >> f
2023 where timed = liftIO (threadDelay (round $ n * 1000000)) >> f
1998-- | @insertBy cmp elem stream@ inserts @elem@ before the first element in
2025-- | @insertBy cmp elem stream@ inserts @elem@ before the first element in