@@ -256,7 +256,6 @@ import Streamly.Internal.Data.Stream.Serial (SerialT(..))
256256import qualified Data.Map.Strict as Map
257257import qualified Streamly.Internal.Data.Pipe.Type as Pipe
258258-- import qualified Streamly.Internal.Data.Stream.IsStream.Enumeration as Stream
259−import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
260259import qualified Prelude
261260
262261import Prelude hiding
@@ -275,7 +274,9 @@ import Streamly.Internal.Data.Fold.Type
275274-- >>> import qualified Streamly.Internal.Data.Stream.IsStream as Stream (parse, foldMany)
276275-- >>> import qualified Streamly.Data.Fold as Fold
277276-- >>> import qualified Streamly.Internal.Data.Fold as Fold
277+-- >>> import qualified Streamly.Internal.Data.Fold.Type as Fold
278278-- >>> import qualified Streamly.Internal.Data.Parser as Parser
279+-- >>> import Streamly.Internal.Data.Stream.Serial (SerialT(..))
279280-- >>> import Data.IORef (newIORef, readIORef, writeIORef)
280281
281282------------------------------------------------------------------------------
@@ -1694,12 +1695,12 @@ chunksBetween _low _high _f1 _f2 = undefined
16941695-- /Warning!/ working on large streams accumulated as buffers in memory could
16951696-- be very inefficient, consider using "Streamly.Data.Array" instead.
16961697--
1697−-- > toStream = foldr K.cons K.nil
1698+-- >>> toStream = fmap SerialT Fold.toStreamK
16981699--
16991700-- /Pre-release/
17001701{-# INLINE toStream #-}
1701−toStream :: Monad m => Fold m a (SerialT Identity a)
1702−toStream = fmap SerialT $ foldr K.cons K.nil
1702+toStream :: Monad m => Fold m a (SerialT n a)
1703+toStream = fmap SerialT toStreamK
17031704
17041705-- This is more efficient than 'toStream'. toStream is exactly the same as
17051706-- reversing the stream after toStreamRev.
@@ -1707,7 +1708,7 @@ toStream = fmap SerialT $ foldr K.cons K.nil
17071708-- | Buffers the input stream to a pure stream in the reverse order of the
17081709-- input.
17091710--
1710−-- > toStreamRev = foldl' (flip K.cons) K.nil
1711+-- >>> toStreamRev = fmap SerialT Fold.toStreamKRev
17111712--
17121713-- /Warning!/ working on large streams accumulated as buffers in memory could
17131714-- be very inefficient, consider using "Streamly.Data.Array" instead.
@@ -1716,5 +1717,5 @@ toStream = fmap SerialT $ foldr K.cons K.nil
17161717
17171718-- xn : ... : x2 : x1 : []
17181719{-# INLINABLE toStreamRev #-}
1719−toStreamRev :: Monad m => Fold m a (SerialT Identity a)
1720−toStreamRev = fmap SerialT $ foldl' (flip K.cons) K.nil
1720+toStreamRev :: Monad m => Fold m a (SerialT n a)
1721+toStreamRev = fmap SerialT toStreamKRev