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.