hw-conduit-0.2.0.2: Conduits for tokenizing streams.

Synopsis

# Documentation

effect :: Monad m => (a -> m b) -> Conduit a m a Source #

Performs the effect but ignores its result. The original value is propagated downstream.

effect' :: Monad m => m b -> Conduit a m a Source #

Performs the effect but ignores its result. The original value is propagated downstream.

inJust :: Monad m => Conduit a m c -> Conduit (Maybe a) m (Maybe c) Source #

mvarSink :: MonadIO m => MVar a -> Sink a m () Source #

Sinks values into a given MVar.

tapWith :: Monad m => Conduit a m b -> Sink b m () -> Conduit a m a Source #

Taps the stream by applying a transformation and sending the transformed value into a given sink. The original value is then propagated downstream.

tapWith projectLefts myErrorSink

tap :: Monad m => Sink a m () -> Conduit a m a Source #

Taps into a given sink. The original value is then propagated downstream.

tapPred :: Monad m => (a -> Bool) -> Sink a m () -> Sink a m () -> Conduit a m a Source #

Taps a conduit, and sends the results into two different sinks, switching on a predicate.

sinkWithPred :: Monad m => (a -> Bool) -> Sink a m () -> Sink a m () -> Sink a m () Source #

Creates a unified sink, which is actually two separate sinks with results being sent to one or the other based on a predicate.

projectNothings :: Monad m => Conduit (Maybe a) m () Source #

Projects nothings from the stream. Returns a stream that only contains nothings (represented by unit)

tapNothing :: Monad m => Sink () m () -> Conduit (Maybe a) m (Maybe a) Source #

For every Nothing value in a stream sends () to a given Sink. Downstream receives an untouched original Maybe value.

divertNothing :: Monad m => Sink () m () -> Conduit (Maybe a) m a Source #

For every Nothing value in a stream sends () to a given Sink. Nothing is then not propagated downstream. Downstream only receives values from Just

projectLefts :: Monad m => Conduit (Either l r) m l Source #

Projects left side values for each value in a stream. Downstream only receives values that were on the left side, the right side is ignored.

projectRights :: Monad m => Conduit (Either l r) m r Source #

Projects right side values for each value in a stream. Downstream only receives values that were on the right side, the left side is ignored.

tapLeft :: Monad m => Sink l m () -> Conduit (Either l r) m (Either l r) Source #

Sends every left-side value in a stream into a given Sink. Downstream receives the original Either value untouched.

divertLeft :: Monad m => Sink l m () -> Conduit (Either l r) m r Source #

Sends every left-side value in a stream into a given Sink. Downstream receives only right-side values.

tapRight :: Monad m => Sink r m () -> Conduit (Either l r) m (Either l r) Source #

Sends every right-side value in a stream into a given Sink. Downstream receives the original Either value untouched.

divertRight :: Monad m => Sink r m () -> Conduit (Either l r) m l Source #

Sends every right-side value in a stream into a given Sink. Downstream receives only left-side values.

everyN :: Monad m => Int -> Conduit a m a Source #