@@ -1567,24 +1567,25 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
15671567-- Interop with @pipes@:
15681568--
15691569-- @
1570−-- import "Streamly.Prelude" (SerialT)
1570+-- import "Streamly.Prelude" (IsStream, MonadAsync, SerialT)
15711571-- import qualified "Streamly.Prelude" as S
15721572-- import qualified Pipes as P
15731573-- import qualified Pipes.Prelude as P
15741574--
15751575-- -- | pipes to streamly
1576−-- fromPipes :: (S.IsStream t, Monad m) => P.Producer a m r -> t m a
1576+-- fromPipes :: (IsStream t, MonadAsync m) => P.Producer a m () -> t m a
15771577-- fromPipes = S.'unfoldrM' unconsP
15781578-- where
15791579-- -- Adapt P.next to return a Maybe instead of Either
1580−-- unconsP p = P.next p >>= either (\\_ -> return Nothing) (return . Just)
1580+-- unconsP p = either (const Nothing) Just <$> P.next p
15811581--
15821582-- -- | streamly to pipes
15831583-- toPipes :: Monad m => SerialT m a -> P.Producer a m ()
1584−-- toPipes = P.unfoldr unconsS
1584+-- toPipes = P.unfoldr unconsEither
15851585-- where
15861586-- -- Adapt S.uncons to return an Either instead of Maybe
1587−-- unconsS s = S.'uncons' s >>= maybe (return $ Left ()) (return . Right)
1587+-- unconsEither :: Monad m => SerialT m a -> m (Either () (a, SerialT m a))
1588+-- unconsEither s = maybe (Left ()) Right <$> S.'uncons' s
15881589--
15891590-- main = do
15901591-- S.'toList' (fromPipes (P.each [1..3])) >>= print
@@ -1594,25 +1595,26 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
15941595-- Interop with @streaming@:
15951596--
15961597-- @
1597−-- import "Streamly.Prelude" (SerialT, MonadAsync)
1598+-- import "Streamly.Prelude" (IsStream, MonadAsync, SerialT)
15981599-- import qualified "Streamly.Prelude" as S
15991600-- import qualified Streaming as SG
16001601-- import qualified Streaming.Prelude as SG
16011602--
16021603-- -- | streaming to streamly
1603−-- fromStreaming :: (IsStream t, MonadAsync m) => SG.Stream (SG.Of a) m r -> t m a
1604−-- fromStreaming = S.unfoldrM SG.uncons
1604+-- fromStreaming :: (IsStream t, MonadAsync m) => SG.Stream (SG.Of a) m () -> t m a
1605+-- fromStreaming = S.'unfoldrM' SG.uncons
16051606--
16061607-- -- | streamly to streaming
16071608-- toStreaming :: Monad m => SerialT m a -> SG.Stream (SG.Of a) m ()
1608−-- toStreaming = SG.unfoldr unconsS
1609+-- toStreaming = SG.unfoldr unconsEither
16091610-- where
16101611-- -- Adapt S.uncons to return an Either instead of Maybe
1611−-- unconsS s = S.'uncons' s >>= maybe (return $ Left ()) (return . Right)
1612+-- unconsEither :: Monad m => SerialT m a -> m (Either () (a, SerialT m a))
1613+-- unconsEither s = maybe (Left ()) Right <$> S.'uncons' s
16121614--
16131615-- main = do
1614−-- S.toList (fromStreaming (SG.each [1..3])) >>= print
1615−-- SG.toList (toStreaming (S.fromFoldable [1..3])) >>= print
1616+-- S.'toList' (fromStreaming (SG.each [1..3])) >>= print
1617+-- SG.toList (toStreaming (S.'fromFoldable' [1..3])) >>= print
16161618-- @
16171619--
16181620-- Interop with @conduit@: