conduit-extra-0.1.3: Experimental helper functions for conduit.

Safe HaskellNone

Data.Conduit.Extra.Resumable

Synopsis

Documentation

data ResumableConduit i m o Source

A generalization of ResumableSource. Allows to resume an arbitrary conduit, keeping its state and using it later (or finalizing it).

Constructors

ResumableConduit (Conduit i m o) (m ()) 

connectResume :: Monad m => ResumableConduit i m o -> Sink o m r -> Sink i m (ResumableConduit i m o, r)Source

Connect a ResumableConduit to a sink and return the output of the sink together with a new ResumableConduit.

(=$$+) :: Monad m => Conduit a m b -> Sink b m r -> Sink a m (ResumableConduit a m b, r)Source

The connect-and-resume operator. This does not close the Conduit, but instead returns it to be used again. This allows a Conduit to be used incrementally in a large program, without forcing the entire program to live in the Sink monad.

Leftover data returned from the Sink will be discarded.

Mnemonic: connect + do more.

(=$$++) :: Monad m => ResumableConduit i m o -> Sink o m r -> Sink i m (ResumableConduit i m o, r)Source

Continue processing after usage of =$$+. An alias for connectResume.

(=$$+-) :: Monad m => ResumableConduit i m o -> Sink o m r -> Sink i m rSource

Complete processing of a ResumableConduit. This will run the finalizer associated with the ResumableConduit. In order to guarantee process resource finalization, you must use this operator after using =$$+ and =$$++.