@@ -1567,24 +1567,25 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
1567-- Interop with @pipes@:
1567-- Interop with @pipes@:
1570−-- import "Streamly.Prelude" (SerialT)
1570+-- import "Streamly.Prelude" (IsStream, MonadAsync, SerialT)
1571-- import qualified "Streamly.Prelude" as S
1571-- import qualified "Streamly.Prelude" as S
1572-- import qualified Pipes as P
1572-- import qualified Pipes as P
1573-- import qualified Pipes.Prelude as P
1573-- import qualified Pipes.Prelude as P
1575-- -- | pipes to streamly
1575-- -- | 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
1577-- fromPipes = S.'unfoldrM' unconsP
1577-- fromPipes = S.'unfoldrM' unconsP
1579-- -- Adapt P.next to return a Maybe instead of Either
1579-- -- 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
1582-- -- | streamly to pipes
1582-- -- | streamly to pipes
1583-- toPipes :: Monad m => SerialT m a -> P.Producer a m ()
1583-- toPipes :: Monad m => SerialT m a -> P.Producer a m ()
1584−-- toPipes = P.unfoldr unconsS
1584+-- toPipes = P.unfoldr unconsEither
1586-- -- Adapt S.uncons to return an Either instead of Maybe
1586-- -- 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
1589-- main = do
1590-- main = do
1590-- S.'toList' (fromPipes (P.each [1..3])) >>= print
1591-- S.'toList' (fromPipes (P.each [1..3])) >>= print
@@ -1594,25 +1595,26 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
1594-- Interop with @streaming@:
1595-- Interop with @streaming@:
1597−-- import "Streamly.Prelude" (SerialT, MonadAsync)
1598+-- import "Streamly.Prelude" (IsStream, MonadAsync, SerialT)
1598-- import qualified "Streamly.Prelude" as S
1599-- import qualified "Streamly.Prelude" as S
1599-- import qualified Streaming as SG
1600-- import qualified Streaming as SG
1600-- import qualified Streaming.Prelude as SG
1601-- import qualified Streaming.Prelude as SG
1602-- -- | streaming to streamly
1603-- -- | streaming to streamly
1603−-- fromStreaming :: (IsStream t, MonadAsync m) => SG.Stream (SG.Of a) m r -> t m a
1604+-- fromStreaming :: (IsStream t, MonadAsync m) => SG.Stream (SG.Of a) m () -> t m a
1604−-- fromStreaming = S.unfoldrM SG.uncons
1605+-- fromStreaming = S.'unfoldrM' SG.uncons
1606-- -- | streamly to streaming
1607-- -- | streamly to streaming
1607-- toStreaming :: Monad m => SerialT m a -> SG.Stream (SG.Of a) m ()
1608-- toStreaming :: Monad m => SerialT m a -> SG.Stream (SG.Of a) m ()
1608−-- toStreaming = SG.unfoldr unconsS
1609+-- toStreaming = SG.unfoldr unconsEither
1610-- -- Adapt S.uncons to return an Either instead of Maybe
1611-- -- 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
1613-- main = do
1615-- main = do
1614−-- S.toList (fromStreaming (SG.each [1..3])) >>= print
1616+-- S.'toList' (fromStreaming (SG.each [1..3])) >>= print
1615−-- SG.toList (toStreaming (S.fromFoldable [1..3])) >>= print
1617+-- SG.toList (toStreaming (S.'fromFoldable' [1..3])) >>= print
1618-- Interop with @conduit@:
1620-- Interop with @conduit@: