-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Translate pull-based stream folds into push-based iteratees. -- -- Translate pull-based folds from the "streaming" package into -- push-based folds from the "foldl" package. @package streaming-eversion @version 0.3.0.1 -- | Most pull-to-push transformations in this module require functions -- that are polymorphic over a monad transformer. -- -- Because of this, some of the type signatures look internals, but -- actually many (suitably polymorphic) operations on Streams will -- unify with them. -- -- To get "interruptible" operations that can exit early with an error, -- put a ExceptT transformer just below the polymorphic monad -- transformer. In practice, that means lifting functions like -- throwE and hoistEither a number of times. -- -- Inspired by -- http://pchiusano.blogspot.com.es/2011/12/programmatic-translation-to-iteratees.html module Streaming.Eversion evert :: (forall m r. Monad m => Stream (Of a) m r -> m (Of x r)) -> Fold a x -- | Like evert, but gives the stream-folding function access to a -- base monad. -- --
--   >>> :{
--       let consume stream = lift (putStrLn "x") >> S.effects stream
--       in  L.foldM (evertM_ consume) ["a","b","c"]
--       :}
--   x
--   
-- -- Note however that control operations can't be lifted through the -- transformer. evertM :: Monad m => (forall t r. (MonadTrans t, Monad (t m)) => Stream (Of a) (t m) r -> t m (Of x r)) -> FoldM m a x evertM_ :: Monad m => (forall t r. (MonadTrans t, Monad (t m)) => Stream (Of a) (t m) r -> t m r) -> FoldM m a () -- | Like evertM, but gives the stream-consuming function the -- ability to use liftIO. -- --
--   >>> L.foldM (evertMIO_ S.print) ["a","b","c"]
--   "a"
--   "b"
--   "c"
--   
evertMIO :: MonadIO m => (forall t r. (MonadTrans t, MonadIO (t m)) => Stream (Of a) (t m) r -> t m (Of x r)) -> FoldM m a x evertMIO_ :: MonadIO m => (forall t r. (MonadTrans t, MonadIO (t m)) => Stream (Of a) (t m) r -> t m r) -> FoldM m a () transvert :: (forall m r. Monad m => Stream (Of a) m r -> Stream (Of b) m r) -> Fold b x -> Fold a x transvertM :: Monad m => (forall t r. (MonadTrans t, Monad (t m)) => Stream (Of a) (t m) r -> Stream (Of b) (t m) r) -> FoldM m b x -> FoldM m a x transvertMIO :: MonadIO m => (forall t r. (MonadTrans t, MonadIO (t m)) => Stream (Of a) (t m) r -> Stream (Of b) (t m) r) -> FoldM m b x -> FoldM m a x generalEvertM :: (Monad m) => (forall r. Stream (Of a) (Stream ((->) (Feed a)) m) r -> Stream ((->) (Feed a)) m (Of b r)) -> FoldM m a b generalTransvertM :: Monad m => (forall r. Stream (Of a) (Stream ((->) (Feed a)) m) r -> Stream (Of b) (Stream ((->) (Feed a)) m) r) -> FoldM m b x -> FoldM m a x -- | Like Streaming.Eversion, but for Producer folds and -- transformations. module Streaming.Eversion.Pipes evert :: (forall m r. Monad m => Producer a m r -> m (x, r)) -> Fold a x evertM :: Monad m => (forall t r. (MonadTrans t, Monad (t m)) => Producer a (t m) r -> t m (x, r)) -> FoldM m a x evertM_ :: Monad m => (forall t r. (MonadTrans t, Monad (t m)) => Producer a (t m) r -> t m r) -> FoldM m a () evertMIO :: MonadIO m => (forall t r. (MonadTrans t, MonadIO (t m)) => Producer a (t m) r -> t m (x, r)) -> FoldM m a x evertMIO_ :: MonadIO m => (forall t r. (MonadTrans t, MonadIO (t m)) => Producer a (t m) r -> t m r) -> FoldM m a () transvert :: (forall m r. Monad m => Producer a m r -> Producer b m r) -> Fold b x -> Fold a x transvertM :: Monad m => (forall t r. (MonadTrans t, Monad (t m)) => Producer a (t m) r -> Producer b (t m) r) -> FoldM m b x -> FoldM m a x transvertMIO :: MonadIO m => (forall t r. (MonadTrans t, MonadIO (t m)) => Producer a (t m) r -> Producer b (t m) r) -> FoldM m b x -> FoldM m a x