Right exactly import qualified Streaming as S import qualified Streaming.Prelude as S import qualified Control.Monad.Trans.Free as F import qualified Pipes as P import qualified Pipes.Prelude as P import qualified Pipes.Group as P
fromFreeT :: (Monad m, Functor f) => F.FreeT f m a -> S.Stream f m a fromStream :: (Monad m, Functor f) => S.Stream f m a -> F.FreeT f m a fromProducers :: (Monad m) => P.FreeT (P.Producer a m) m r -> S.Stream (S.Stream (S.Of a) m) m r fromStreams :: Monad m => S.Stream (S.Stream (S.Of a) m) m r -> P.FreeT (P.Producer a m) m r fromFreeT = F.iterTM S.wrap fromStream = S.iterTM F.wrap fromProducers = S.maps (S.unfoldr P.next) . F.iterTM S.wrap fromStreams = P.maps (P.unfoldr S.next) . S.iterTM F.wrap I was preferring the `unfold uncons` style over `fold cons` partly because I had a plan of convince the streaming io libraries to adopt this as a common incantation for interoperation. `fold` expressions tend already to be taken up and to suggest the strict left fold in all of them. I wrote patches for io-streams and conduit but got lost thinking how best to argue for the plan. Part of the trouble is that `conduit` seems pretty suspicious of anything that would permit direct inspection of a source, `io-streams`, `list-t` and company would have the different objection that the functions would have no other use but interoperation. On Thursday, February 18, 2016 at 5:10:30 PM UTC-5, Tom Ellis wrote: > > On Thu, Feb 18, 2016 at 01:38:32PM -0800, Daniel Díaz wrote: > > The documentation for the "streaming > > <http://hackage.haskell.org/package/streaming>" package explains from > to > > convert a pipes Producer into a Stream and back, but is it also possible > to > > define a function with the following signature? > > > > FreeT (Producer a IO) IO r -> Stream (Stream (Of a) IO) IO r > > I guess you can combine the following: > > Free.iterTM Stream.wrap :: FreeT f m a -> Stream f m a > Streaming.unfoldr Pipes.next :: Producer a m r -> Stream (Of a) m r > maps :: (forall x . f x -> g x) -> Stream f m r -> Stream g m r > > Tom > -- You received this message because you are subscribed to the Google Groups "Haskell Pipes" group. To unsubscribe from this group and stop receiving emails from it, send an email to haskell-pipes+unsubscr...@googlegroups.com. To post to this group, send email to haskell-pipes@googlegroups.com.