conduit-1.3.6: Streaming data processing library.

Safe Haskell | Safe
Language | Haskell2010

Data.Conduit.Internal

Contents

- Pipe
- Conduit
- Fusion (highly experimental!!!)

Synopsis

- enumFromTo :: forall o (m :: Type -> Type) l i u. (Enum o, Eq o, Monad m) => o -> o -> Pipe l i o u m ()
- yield :: forall (m :: Type -> Type) o l i u. Monad m => o -> Pipe l i o u m ()
- data Pipe l i o u (m :: Type -> Type) r
  - = HaveOutput (Pipe l i o u m r) o
  - | NeedInput (i -> Pipe l i o u m r) (u -> Pipe l i o u m r)
  - | Done r
  - | PipeM (m (Pipe l i o u m r))
  - | Leftover (Pipe l i o u m r) l
- await :: forall l i o u (m :: Type -> Type). Pipe l i o u m (Maybe i)
- yieldM :: Monad m => m o -> Pipe l i o u m ()
- leftover :: forall l i o u (m :: Type -> Type). l -> Pipe l i o u m ()
- bracketP :: forall (m :: Type -> Type) a l i o u r. MonadResource m => IO a -> (a -> IO ()) -> (a -> Pipe l i o u m r) -> Pipe l i o u m r
- awaitForever :: forall (m :: Type -> Type) i l o r r'. Monad m => (i -> Pipe l i o r m r') -> Pipe l i o r m r
- transPipe :: Monad m => (forall a. m a -> n a) -> Pipe l i o u m r -> Pipe l i o u n r
- mapOutput :: forall (m :: Type -> Type) o1 o2 l i u r. Monad m => (o1 -> o2) -> Pipe l i o1 u m r -> Pipe l i o2 u m r
- mapOutputMaybe :: forall (m :: Type -> Type) o1 o2 l i u r. Monad m => (o1 -> Maybe o2) -> Pipe l i o1 u m r -> Pipe l i o2 u m r
- mapInput :: forall (m :: Type -> Type) i1 i2 l2 l1 o u r. Monad m => (i1 -> i2) -> (l2 -> Maybe l1) -> Pipe l2 i2 o u m r -> Pipe l1 i1 o u m r
- sourceList :: forall (m :: Type -> Type) a l i u. Monad m => [a] -> Pipe l i a u m ()
- unconsM :: Monad m => Pipe Void () o () m () -> m (Maybe (o, Pipe Void () o () m ()))
- unconsEitherM :: Monad m => Pipe Void () o () m r -> m (Either r (o, Pipe Void () o () m r))
- awaitE :: forall l i o u (m :: Type -> Type). Pipe l i o u m (Either u i)
- idP :: forall (m :: Type -> Type) l a r. Monad m => Pipe l a a r m r
- pipe :: forall (m :: Type -> Type) l a b r0 r1 c r2. Monad m => Pipe l a b r0 m r1 -> Pipe Void b c r1 m r2 -> Pipe l a c r0 m r2
- pipeL :: forall (m :: Type -> Type) l a b r0 r1 c r2. Monad m => Pipe l a b r0 m r1 -> Pipe b b c r1 m r2 -> Pipe l a c r0 m r2
- runPipe :: Monad m => Pipe Void () Void () m r -> m r
- injectLeftovers :: forall (m :: Type -> Type) i o u r l. Monad m => Pipe i i o u m r -> Pipe l i o u m r
- (>+>) :: forall (m :: Type -> Type) l a b r0 r1 c r2. Monad m => Pipe l a b r0 m r1 -> Pipe Void b c r1 m r2 -> Pipe l a c r0 m r2
- (<+<) :: forall (m :: Type -> Type) b c r1 r2 l a r0. Monad m => Pipe Void b c r1 m r2 -> Pipe l a b r0 m r1 -> Pipe l a c r0 m r2
- catchP :: forall (m :: Type -> Type) e l i o u r. (MonadUnliftIO m, Exception e) => Pipe l i o u m r -> (e -> Pipe l i o u m r) -> Pipe l i o u m r
- handleP :: forall (m :: Type -> Type) e l i o u r. (MonadUnliftIO m, Exception e) => (e -> Pipe l i o u m r) -> Pipe l i o u m r -> Pipe l i o u m r
- tryP :: forall (m :: Type -> Type) e l i o u r. (MonadUnliftIO m, Exception e) => Pipe l i o u m r -> Pipe l i o u m (Either e r)
- withUpstream :: forall (m :: Type -> Type) l i o u r. Monad m => Pipe l i o u m r -> Pipe l i o u m (u, r)
- generalizeUpstream :: forall (m :: Type -> Type) l i o r u. Monad m => Pipe l i o () m r -> Pipe l i o u m r
- data Flush a
  - = Chunk a
  - | Flush
- ($$) :: Monad m => Source m a -> Sink a m b -> m b
- newtype ConduitT i o (m :: Type -> Type) r = ConduitT {
  - unConduitT :: forall b. (r -> Pipe i i o () m b) -> Pipe i i o () m b
  }
- type Source (m :: Type -> Type) o = ConduitT () o m ()
- type Conduit i (m :: Type -> Type) o = ConduitT i o m ()
- type Sink i = ConduitT i Void
- type ConduitM = ConduitT
- (.|) :: forall (m :: Type -> Type) a b c r. Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r
- connect :: Monad m => ConduitT () a m () -> ConduitT a Void m r -> m r
- fuse :: forall (m :: Type -> Type) a b c r. Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r
- ($=) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r
- (=$) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r
- (=$=) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r
- fuseBoth :: forall (m :: Type -> Type) a b r1 c r2. Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (r1, r2)
- fuseBothMaybe :: forall (m :: Type -> Type) a b r1 c r2. Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (Maybe r1, r2)
- fuseUpstream :: forall (m :: Type -> Type) a b r c. Monad m => ConduitT a b m r -> ConduitT b c m () -> ConduitT a c m r
- runConduit :: Monad m => ConduitT () Void m r -> m r
- runConduitPure :: ConduitT () Void Identity r -> r
- runConduitRes :: MonadUnliftIO m => ConduitT () Void (ResourceT m) r -> m r
- catchC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => ConduitT i o m r -> (e -> ConduitT i o m r) -> ConduitT i o m r
- handleC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => (e -> ConduitT i o m r) -> ConduitT i o m r -> ConduitT i o m r
- tryC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => ConduitT i o m r -> ConduitT i o m (Either e r)
- type Producer (m :: Type -> Type) o = forall i. ConduitT i o m ()
- type Consumer i (m :: Type -> Type) r = forall o. ConduitT i o m r
- toProducer :: forall (m :: Type -> Type) a i. Monad m => ConduitT () a m () -> ConduitT i a m ()
- toConsumer :: forall (m :: Type -> Type) a b o. Monad m => ConduitT a Void m b -> ConduitT a o m b
- mergeSource :: forall (m :: Type -> Type) i a. Monad m => ConduitT () i m () -> ConduitT a (i, a) m ()
- passthroughSink :: Monad m => ConduitT i Void m r -> (r -> m ()) -> ConduitT i i m ()
- sourceToList :: Monad m => ConduitT () a m () -> m [a]
- newtype SealedConduitT i o (m :: Type -> Type) r = SealedConduitT (Pipe i i o () m r)
- sealConduitT :: forall i o (m :: Type -> Type) r. ConduitT i o m r -> SealedConduitT i o m r
- unsealConduitT :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m r -> ConduitT i o m r
- ($$+) :: Monad m => ConduitT () a m () -> ConduitT a Void m b -> m (SealedConduitT () a m (), b)
- ($$++) :: Monad m => SealedConduitT () a m () -> ConduitT a Void m b -> m (SealedConduitT () a m (), b)
- ($$+-) :: Monad m => SealedConduitT () a m () -> ConduitT a Void m b -> m b
- ($=+) :: forall (m :: Type -> Type) a b. Monad m => SealedConduitT () a m () -> ConduitT a b m () -> SealedConduitT () b m ()
- (=$$+) :: forall (m :: Type -> Type) a b r. Monad m => ConduitT a b m () -> ConduitT b Void m r -> ConduitT a Void m (SealedConduitT a b m (), r)
- (=$$++) :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m (SealedConduitT i o m (), r)
- (=$$+-) :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m r
- fuseLeftovers :: forall (m :: Type -> Type) b a c r. Monad m => ([b] -> [a]) -> ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r
- fuseReturnLeftovers :: forall (m :: Type -> Type) a b c r. Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m (r, [b])
- newtype ZipSource (m :: Type -> Type) o = ZipSource {
  - getZipSource :: ConduitT () o m ()
  }
- sequenceSources :: forall f (m :: Type -> Type) o. (Traversable f, Monad m) => f (ConduitT () o m ()) -> ConduitT () (f o) m ()
- newtype ZipSink i (m :: Type -> Type) r = ZipSink {
  - getZipSink :: ConduitT i Void m r
  }
- sequenceSinks :: forall f (m :: Type -> Type) i r. (Traversable f, Monad m) => f (ConduitT i Void m r) -> ConduitT i Void m (f r)
- newtype ZipConduit i o (m :: Type -> Type) r = ZipConduit {
  - getZipConduit :: ConduitT i o m r
  }
- sequenceConduits :: forall f (m :: Type -> Type) i o r. (Traversable f, Monad m) => f (ConduitT i o m r) -> ConduitT i o m (f r)
- connectResume :: Monad m => SealedConduitT () a m () -> ConduitT a Void m r -> m (SealedConduitT () a m (), r)
- connectResumeConduit :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m (SealedConduitT i o m (), r)
- sourceToPipe :: forall (m :: Type -> Type) o l i u. Monad m => ConduitT () o m () -> Pipe l i o u m ()
- sinkToPipe :: forall (m :: Type -> Type) i r l o u. Monad m => ConduitT i Void m r -> Pipe l i o u m r
- conduitToPipe :: forall (m :: Type -> Type) i o l u. Monad m => ConduitT i o m () -> Pipe l i o u m ()
- zipSinks :: forall (m :: Type -> Type) i r r'. Monad m => ConduitT i Void m r -> ConduitT i Void m r' -> ConduitT i Void m (r, r')
- zipSources :: forall (m :: Type -> Type) a b. Monad m => ConduitT () a m () -> ConduitT () b m () -> ConduitT () (a, b) m ()
- zipSourcesApp :: forall (m :: Type -> Type) a b. Monad m => ConduitT () (a -> b) m () -> ConduitT () a m () -> ConduitT () b m ()
- zipConduitApp :: forall (m :: Type -> Type) i o x y. Monad m => ConduitT i o m (x -> y) -> ConduitT i o m x -> ConduitT i o m y
- module Data.Conduit.Internal.Fusion

# Pipe

enumFromTo :: forall o (m :: Type -> Type) l i u. (Enum o, Eq o, Monad m) => o -> o -> Pipe l i o u m () #

yield #

Arguments

:: forall (m :: Type -> Type) o l i u. Monad m |
=> o | output value
-> Pipe l i o u m () |

Send a single output value downstream. If the downstream `Pipe` terminates, this `Pipe` will terminate as well.

Since 0.5.0

data Pipe l i o u (m :: Type -> Type) r #

The underlying datatype for all the types in this package. In has six type parameters:

- l is the type of values that may be left over from this `Pipe`. A `Pipe` with no leftovers would use `Void` here, and one with leftovers would use the same type as the i parameter. Leftovers are automatically provided to the next `Pipe` in the monadic chain.
- i is the type of values for this `Pipe`'s input stream.
- o is the type of values for this `Pipe`'s output stream.
- u is the result type from the upstream `Pipe`.
- m is the underlying monad.
- r is the result type.

A basic intuition is that every `Pipe` produces a stream of output values (o), and eventually indicates that this stream is terminated by sending a result (r). On the receiving end of a `Pipe`, these become the i and u parameters.

Since 0.5.0

Constructors

HaveOutput (Pipe l i o u m r) o | Provide new output to be sent downstream. This constructor has two fields: the next `Pipe` to be used and the output value.
NeedInput (i -> Pipe l i o u m r) (u -> Pipe l i o u m r) | Request more input from upstream. The first field takes a new input value and provides a new `Pipe`. The second takes an upstream result value, which indicates that upstream is producing no more results.
Done r | Processing with this `Pipe` is complete, providing the final result.
PipeM (m (Pipe l i o u m r)) | Require running of a monadic action to get the next `Pipe`.
Leftover (Pipe l i o u m r) l | Return leftover input, which should be provided to future operations.

#### Instances

Instances details

MonadRWS r w s m => MonadRWS r w s (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe
MonadError e m => MonadError e (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods throwError :: e -> Pipe l i o u m a # catchError :: Pipe l i o u m a -> (e -> Pipe l i o u m a) -> Pipe l i o u m a #
MonadReader r m => MonadReader r (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods ask :: Pipe l i o u m r # local :: (r -> r) -> Pipe l i o u m a -> Pipe l i o u m a # reader :: (r -> a) -> Pipe l i o u m a #
MonadState s m => MonadState s (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods get :: Pipe l i o u m s # put :: s -> Pipe l i o u m () # state :: (s -> (a, s)) -> Pipe l i o u m a #
MonadWriter w m => MonadWriter w (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods writer :: (a, w) -> Pipe l i o u m a # tell :: w -> Pipe l i o u m () # listen :: Pipe l i o u m a -> Pipe l i o u m (a, w) # pass :: Pipe l i o u m (a, w -> w) -> Pipe l i o u m a #
MonadTrans (Pipe l i o u) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods lift :: Monad m => m a -> Pipe l i o u m a #
MonadIO m => MonadIO (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods liftIO :: IO a -> Pipe l i o u m a #
MonadThrow m => MonadThrow (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods throwM :: (HasCallStack, Exception e) => e -> Pipe l i o u m a #
Monad m => Applicative (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods pure :: a -> Pipe l i o u m a # (<*>) :: Pipe l i o u m (a -> b) -> Pipe l i o u m a -> Pipe l i o u m b # liftA2 :: (a -> b -> c) -> Pipe l i o u m a -> Pipe l i o u m b -> Pipe l i o u m c # (*>) :: Pipe l i o u m a -> Pipe l i o u m b -> Pipe l i o u m b # (<*) :: Pipe l i o u m a -> Pipe l i o u m b -> Pipe l i o u m a #
Monad m => Functor (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods fmap :: (a -> b) -> Pipe l i o u m a -> Pipe l i o u m b # (<$) :: a -> Pipe l i o u m b -> Pipe l i o u m a #
Monad m => Monad (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods (>>=) :: Pipe l i o u m a -> (a -> Pipe l i o u m b) -> Pipe l i o u m b # (>>) :: Pipe l i o u m a -> Pipe l i o u m b -> Pipe l i o u m b # return :: a -> Pipe l i o u m a #
PrimMonad m => PrimMonad (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Associated Types
type PrimState (Pipe l i o u m) |
Instance details Defined in Data.Conduit.Internal.Pipe type PrimState (Pipe l i o u m) = PrimState m
Methods primitive :: (State# (PrimState (Pipe l i o u m)) -> (# State# (PrimState (Pipe l i o u m)), a #)) -> Pipe l i o u m a #
MonadResource m => MonadResource (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods liftResourceT :: ResourceT IO a -> Pipe l i o u m a #
Monad m => Monoid (Pipe l i o u m ()) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods mempty :: Pipe l i o u m () # mappend :: Pipe l i o u m () -> Pipe l i o u m () -> Pipe l i o u m () # mconcat :: [Pipe l i o u m ()] -> Pipe l i o u m () #
Monad m => Semigroup (Pipe l i o u m ()) # |
Instance details Defined in Data.Conduit.Internal.Pipe Methods (<>) :: Pipe l i o u m () -> Pipe l i o u m () -> Pipe l i o u m () # sconcat :: NonEmpty (Pipe l i o u m ()) -> Pipe l i o u m () # stimes :: Integral b => b -> Pipe l i o u m () -> Pipe l i o u m () #
type PrimState (Pipe l i o u m) # |
Instance details Defined in Data.Conduit.Internal.Pipe type PrimState (Pipe l i o u m) = PrimState m

await :: forall l i o u (m :: Type -> Type). Pipe l i o u m (Maybe i) #

Wait for a single input value from upstream.

Since 0.5.0

yieldM :: Monad m => m o -> Pipe l i o u m () #

leftover :: forall l i o u (m :: Type -> Type). l -> Pipe l i o u m () #

Provide a single piece of leftover input to be consumed by the next pipe in the current monadic binding.

Note: it is highly encouraged to only return leftover values from input already consumed from upstream.

Since 0.5.0

bracketP #

Arguments

:: forall (m :: Type -> Type) a l i o u r. MonadResource m |
=> IO a | computation to run first ("acquire resource")
-> (a -> IO ()) | computation to run last ("release resource")
-> (a -> Pipe l i o u m r) | computation to run in-between
-> Pipe l i o u m r |

Bracket a pipe computation between allocation and release of a resource. We guarantee, via the `MonadResource` context, that the resource finalization is exception safe. However, it will not necessarily be prompt, in that running a finalizer may wait until the `ResourceT` block exits.

Since 0.5.0

awaitForever :: forall (m :: Type -> Type) i l o r r'. Monad m => (i -> Pipe l i o r m r') -> Pipe l i o r m r #

Wait for input forever, calling the given inner `Pipe` for each piece of new input. Returns the upstream result type.

Since 0.5.0

transPipe :: Monad m => (forall a. m a -> n a) -> Pipe l i o u m r -> Pipe l i o u n r #

Transform the monad that a `Pipe` lives in.

Note that the monad transforming function will be run multiple times, resulting in unintuitive behavior in some cases. For a fuller treatment, please see:

https://github.com/snoyberg/conduit/wiki/Dealing-with-monad-transformers

This function is just a synonym for `hoist`.

Since 0.4.0

mapOutput :: forall (m :: Type -> Type) o1 o2 l i u r. Monad m => (o1 -> o2) -> Pipe l i o1 u m r -> Pipe l i o2 u m r #

Apply a function to all the output values of a `Pipe`.

This mimics the behavior of `fmap` for a `Source` and `Conduit` in pre-0.4 days.

Since 0.4.1

mapOutputMaybe :: forall (m :: Type -> Type) o1 o2 l i u r. Monad m => (o1 -> Maybe o2) -> Pipe l i o1 u m r -> Pipe l i o2 u m r #

Same as `mapOutput`, but use a function that returns `Maybe` values.

Since 0.5.0

mapInput #

Arguments

:: forall (m :: Type -> Type) i1 i2 l2 l1 o u r. Monad m |
=> (i1 -> i2) | map initial input to new input
-> (l2 -> Maybe l1) | map new leftovers to initial leftovers
-> Pipe l2 i2 o u m r |
-> Pipe l1 i1 o u m r |

Apply a function to all the input values of a `Pipe`.

Since 0.5.0

sourceList :: forall (m :: Type -> Type) a l i u. Monad m => [a] -> Pipe l i a u m () #

Convert a list into a source.

Since 0.3.0

unconsM :: Monad m => Pipe Void () o () m () -> m (Maybe (o, Pipe Void () o () m ())) #

Split a pipe into head and tail.

Since 1.3.3

unconsEitherM :: Monad m => Pipe Void () o () m r -> m (Either r (o, Pipe Void () o () m r)) #

Split a pipe into head and tail or return its result if it is done.

Since 1.3.3

awaitE :: forall l i o u (m :: Type -> Type). Pipe l i o u m (Either u i) #

This is similar to `await`, but will return the upstream result value as `Left` if available.

Since 0.5.0

idP :: forall (m :: Type -> Type) l a r. Monad m => Pipe l a a r m r #

The identity `Pipe`.

Since 0.5.0

pipe :: forall (m :: Type -> Type) l a b r0 r1 c r2. Monad m => Pipe l a b r0 m r1 -> Pipe Void b c r1 m r2 -> Pipe l a c r0 m r2 #

Compose a left and right pipe together into a complete pipe.

Since 0.5.0

pipeL :: forall (m :: Type -> Type) l a b r0 r1 c r2. Monad m => Pipe l a b r0 m r1 -> Pipe b b c r1 m r2 -> Pipe l a c r0 m r2 #

Same as `pipe`, but automatically applies `injectLeftovers` to the right `Pipe`.

Since 0.5.0

runPipe :: Monad m => Pipe Void () Void () m r -> m r #

Run a pipeline until processing completes.

Since 0.5.0

injectLeftovers :: forall (m :: Type -> Type) i o u r l. Monad m => Pipe i i o u m r -> Pipe l i o u m r #

Transforms a `Pipe` that provides leftovers to one which does not, allowing it to be composed.

This function will provide any leftover values within this `Pipe` to any calls to `await`. If there are more leftover values than are demanded, the remainder are discarded.

Since 0.5.0

(>+>) :: forall (m :: Type -> Type) l a b r0 r1 c r2. Monad m => Pipe l a b r0 m r1 -> Pipe Void b c r1 m r2 -> Pipe l a c r0 m r2 infixl 9 #

Fuse together two `Pipe`s, connecting the output from the left to the input of the right.

Notice that the leftover parameter for the `Pipe`s must be `Void`. This ensures that there is no accidental data loss of leftovers during fusion. If you have a `Pipe` with leftovers, you must first call `injectLeftovers`.

Since 0.5.0

(<+<) :: forall (m :: Type -> Type) b c r1 r2 l a r0. Monad m => Pipe Void b c r1 m r2 -> Pipe l a b r0 m r1 -> Pipe l a c r0 m r2 infixr 9 #

Same as `>+>`, but reverse the order of the arguments.

Since 0.5.0

catchP :: forall (m :: Type -> Type) e l i o u r. (MonadUnliftIO m, Exception e) => Pipe l i o u m r -> (e -> Pipe l i o u m r) -> Pipe l i o u m r #

See `catchC` for more details.

Since 1.0.11

handleP :: forall (m :: Type -> Type) e l i o u r. (MonadUnliftIO m, Exception e) => (e -> Pipe l i o u m r) -> Pipe l i o u m r -> Pipe l i o u m r #

The same as `flip catchP`.

Since 1.0.11

tryP :: forall (m :: Type -> Type) e l i o u r. (MonadUnliftIO m, Exception e) => Pipe l i o u m r -> Pipe l i o u m (Either e r) #

See `tryC` for more details.

Since 1.0.11

withUpstream :: forall (m :: Type -> Type) l i o u r. Monad m => Pipe l i o u m r -> Pipe l i o u m (u, r) #

Returns a tuple of the upstream and downstream results. Note that this will force consumption of the entire input stream.

Since 0.5.0

generalizeUpstream :: forall (m :: Type -> Type) l i o r u. Monad m => Pipe l i o () m r -> Pipe l i o u m r #

Generalize the upstream return value for a `Pipe` from unit to any type.

Since 1.1.5

# Conduit

data Flush a #

Provide for a stream of data that can be flushed.

A number of `Conduit`s (e.g., zlib compression) need the ability to flush the stream at some point. This provides a single wrapper datatype to be used in all such circumstances.

Since 0.3.0

Constructors

Chunk a |
Flush |

#### Instances

Instances details

Functor Flush # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods fmap :: (a -> b) -> Flush a -> Flush b # (<$) :: a -> Flush b -> Flush a #
Show a => Show (Flush a) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods showsPrec :: Int -> Flush a -> ShowS # show :: Flush a -> String # showList :: [Flush a] -> ShowS #
Eq a => Eq (Flush a) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods (==) :: Flush a -> Flush a -> Bool # (/=) :: Flush a -> Flush a -> Bool #
Ord a => Ord (Flush a) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods compare :: Flush a -> Flush a -> Ordering # (<) :: Flush a -> Flush a -> Bool # (<=) :: Flush a -> Flush a -> Bool # (>) :: Flush a -> Flush a -> Bool # (>=) :: Flush a -> Flush a -> Bool # max :: Flush a -> Flush a -> Flush a # min :: Flush a -> Flush a -> Flush a #

($$) :: Monad m => Source m a -> Sink a m b -> m b infixr 0 #

Deprecated: Use runConduit and .|

The connect operator, which pulls data from a source and pushes to a sink. If you would like to keep the `Source` open to be used for other operations, use the connect-and-resume operator `$$+`.

Since 0.4.0

newtype ConduitT i o (m :: Type -> Type) r #

Core datatype of the conduit package. This type represents a general component which can consume a stream of input values `i`, produce a stream of output values `o`, perform actions in the `m` monad, and produce a final result `r`. The type synonyms provided here are simply wrappers around this type.

Since 1.3.0

Constructors

ConduitT |
Fields unConduitT :: forall b. (r -> Pipe i i o () m b) -> Pipe i i o () m b

#### Instances

Instances details

MonadRWS r w s m => MonadRWS r w s (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit
MonadError e m => MonadError e (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods throwError :: e -> ConduitT i o m a # catchError :: ConduitT i o m a -> (e -> ConduitT i o m a) -> ConduitT i o m a #
MonadReader r m => MonadReader r (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods ask :: ConduitT i o m r # local :: (r -> r) -> ConduitT i o m a -> ConduitT i o m a # reader :: (r -> a) -> ConduitT i o m a #
MonadState s m => MonadState s (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods get :: ConduitT i o m s # put :: s -> ConduitT i o m () # state :: (s -> (a, s)) -> ConduitT i o m a #
MonadWriter w m => MonadWriter w (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods writer :: (a, w) -> ConduitT i o m a # tell :: w -> ConduitT i o m () # listen :: ConduitT i o m a -> ConduitT i o m (a, w) # pass :: ConduitT i o m (a, w -> w) -> ConduitT i o m a #
MonadTrans (ConduitT i o) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods lift :: Monad m => m a -> ConduitT i o m a #
MonadIO m => MonadIO (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods liftIO :: IO a -> ConduitT i o m a #
MonadThrow m => MonadThrow (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods throwM :: (HasCallStack, Exception e) => e -> ConduitT i o m a #
Applicative (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods pure :: a -> ConduitT i o m a # (<*>) :: ConduitT i o m (a -> b) -> ConduitT i o m a -> ConduitT i o m b # liftA2 :: (a -> b -> c) -> ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m c # (*>) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m b # (<*) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m a #
Functor (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods fmap :: (a -> b) -> ConduitT i o m a -> ConduitT i o m b # (<$) :: a -> ConduitT i o m b -> ConduitT i o m a #
Monad (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods (>>=) :: ConduitT i o m a -> (a -> ConduitT i o m b) -> ConduitT i o m b # (>>) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m b # return :: a -> ConduitT i o m a #
MonadFail m => MonadFail (ConduitT i o m) # | Since: 1.3.1
Instance details Defined in Data.Conduit.Internal.Conduit Methods fail :: String -> ConduitT i o m a #
PrimMonad m => PrimMonad (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Associated Types
type PrimState (ConduitT i o m) |
Instance details Defined in Data.Conduit.Internal.Conduit type PrimState (ConduitT i o m) = PrimState m
Methods primitive :: (State# (PrimState (ConduitT i o m)) -> (# State# (PrimState (ConduitT i o m)), a #)) -> ConduitT i o m a #
MonadResource m => MonadResource (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods liftResourceT :: ResourceT IO a -> ConduitT i o m a #
Monad m => Monoid (ConduitT i o m ()) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods mempty :: ConduitT i o m () # mappend :: ConduitT i o m () -> ConduitT i o m () -> ConduitT i o m () # mconcat :: [ConduitT i o m ()] -> ConduitT i o m () #
Monad m => Semigroup (ConduitT i o m ()) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods (<>) :: ConduitT i o m () -> ConduitT i o m () -> ConduitT i o m () # sconcat :: NonEmpty (ConduitT i o m ()) -> ConduitT i o m () # stimes :: Integral b => b -> ConduitT i o m () -> ConduitT i o m () #
type PrimState (ConduitT i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit type PrimState (ConduitT i o m) = PrimState m

type Source (m :: Type -> Type) o = ConduitT () o m () #

Deprecated: Use ConduitT directly

Provides a stream of output values, without consuming any input or producing a final result.

Since 0.5.0

type Conduit i (m :: Type -> Type) o = ConduitT i o m () #

Deprecated: Use ConduitT directly

Consumes a stream of input values and produces a stream of output values, without producing a final result.

Since 0.5.0

type Sink i = ConduitT i Void #

Deprecated: Use ConduitT directly

Consumes a stream of input values and produces a final result, without producing any output.

    type Sink i m r = ConduitT i Void m r

Since 0.5.0

type ConduitM = ConduitT #

Same as `ConduitT`, for backwards compat

(.|) infixr 2 #

Arguments

:: forall (m :: Type -> Type) a b c r. Monad m |
=> ConduitT a b m () | upstream
-> ConduitT b c m r | downstream
-> ConduitT a c m r |

Combine two `Conduit`s together into a new `Conduit` (aka `fuse`).

Output from the upstream (left) conduit will be fed into the downstream (right) conduit. Processing will terminate when downstream (right) returns. Leftover data returned from the right `Conduit` will be discarded.

Equivalent to `fuse` and `=$=`, however the latter is deprecated and will be removed in a future version.

Note that, while this operator looks like categorical composition (from Control.Category), there are a few reasons it's different:

- The position of the type parameters to `ConduitT` do not match. We would need to change `ConduitT i o m r` to `ConduitT r m i o`, which would preclude a `Monad` or `MonadTrans` instance.
- The result value from upstream and downstream are allowed to differ between upstream and downstream. In other words, we would need the type signature here to look like `ConduitT a b m r -> ConduitT b c m r -> ConduitT a c m r`.
- Due to leftovers, we do not have a left identity in Conduit. This can be achieved with the underlying `Pipe` datatype, but this is not generally recommended. See https://stackoverflow.com/a/15263700.

Since: 1.2.8

connect :: Monad m => ConduitT () a m () -> ConduitT a Void m r -> m r #

Equivalent to using `runConduit` and `.|` together.

Since 1.2.3

fuse :: forall (m :: Type -> Type) a b c r. Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r #

Named function synonym for `.|`

Equivalent to `.|` and `=$=`. However, the latter is deprecated and will be removed in a future version.

Since 1.2.3

($=) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r infixl 1 #

Deprecated: Use .|

A synonym for `=$=` for backwards compatibility.

Since 0.4.0

(=$) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r infixr 2 #

Deprecated: Use .|

A synonym for `=$=` for backwards compatibility.

Since 0.4.0

(=$=) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a m b -> ConduitT b c m r -> ConduitT a c m r infixr 2 #

Deprecated: Use .|

Deprecated fusion operator.

Since 0.4.0

fuseBoth :: forall (m :: Type -> Type) a b r1 c r2. Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (r1, r2) #

Fuse two `ConduitT`s together, and provide the return value of both. Note that this will force the entire upstream `ConduitT` to be run to produce the result value, even if the downstream terminates early.

Since 1.1.5

fuseBothMaybe :: forall (m :: Type -> Type) a b r1 c r2. Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (Maybe r1, r2) #

Like `fuseBoth`, but does not force consumption of the `Producer`. In the case that the `Producer` terminates, the result value is provided as a `Just` value. If it does not terminate, then a `Nothing` value is returned.

One thing to note here is that "termination" here only occurs if the `Producer` actually yields a `Nothing` value. For example, with the `Producer` `mapM_ yield [1..5]`, if five values are requested, the `Producer` has not yet terminated. Termination only occurs when the sixth value is awaited for and the `Producer` signals termination.

Since 1.2.4

fuseUpstream :: forall (m :: Type -> Type) a b r c. Monad m => ConduitT a b m r -> ConduitT b c m () -> ConduitT a c m r #

Same as `fuseBoth`, but ignore the return value from the downstream `Conduit`. Same caveats of forced consumption apply.

Since 1.1.5

runConduit :: Monad m => ConduitT () Void m r -> m r #

Run a pipeline until processing completes.

Since 1.2.1

runConduitPure :: ConduitT () Void Identity r -> r #

Run a pure pipeline until processing completes, i.e. a pipeline with `Identity` as the base monad. This is equivalient to `runIdentity . runConduit`.

Since: 1.2.8

runConduitRes :: MonadUnliftIO m => ConduitT () Void (ResourceT m) r -> m r #

Run a pipeline which acquires resources with `ResourceT`, and then run the `ResourceT` transformer. This is equivalent to `runResourceT . runConduit`.

Since: 1.2.8

catchC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => ConduitT i o m r -> (e -> ConduitT i o m r) -> ConduitT i o m r #

Catch all exceptions thrown by the current component of the pipeline.

Note: this will not catch exceptions thrown by other components! For example, if an exception is thrown in a `Source` feeding to a `Sink`, and the `Sink` uses `catchC`, the exception will not be caught.

Due to this behavior (as well as lack of async exception safety), you should not try to implement combinators such as `onException` in terms of this primitive function.

Note also that the exception handling will not be applied to any finalizers generated by this conduit.

Since 1.0.11

handleC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => (e -> ConduitT i o m r) -> ConduitT i o m r -> ConduitT i o m r #

The same as `flip catchC`.

Since 1.0.11

tryC :: forall (m :: Type -> Type) e i o r. (MonadUnliftIO m, Exception e) => ConduitT i o m r -> ConduitT i o m (Either e r) #

A version of `try` for use within a pipeline. See the comments in `catchC` for more details.

Since 1.0.11

type Producer (m :: Type -> Type) o = forall i. ConduitT i o m () #

Deprecated: Use ConduitT directly

A component which produces a stream of output values, regardless of the input stream. A `Producer` is a generalization of a `Source`, and can be used as either a `Source` or a `Conduit`.

Since 1.0.0

type Consumer i (m :: Type -> Type) r = forall o. ConduitT i o m r #

Deprecated: Use ConduitT directly

A component which consumes a stream of input values and produces a final result, regardless of the output stream. A `Consumer` is a generalization of a `Sink`, and can be used as either a `Sink` or a `Conduit`.

Since 1.0.0

toProducer :: forall (m :: Type -> Type) a i. Monad m => ConduitT () a m () -> ConduitT i a m () #

Generalize a `Source` to a `Producer`.

Since 1.0.0

toConsumer :: forall (m :: Type -> Type) a b o. Monad m => ConduitT a Void m b -> ConduitT a o m b #

Generalize a `Sink` to a `Consumer`.

Since 1.0.0

mergeSource :: forall (m :: Type -> Type) i a. Monad m => ConduitT () i m () -> ConduitT a (i, a) m () #

Merge a `Source` into a `Conduit`. The new conduit will stop processing once either source or upstream have been exhausted.

passthroughSink #

Arguments

:: Monad m |
=> ConduitT i Void m r |
-> (r -> m ()) | finalizer
-> ConduitT i i m () |

Turn a `Sink` into a `Conduit` in the following way:

- All input passed to the `Sink` is yielded downstream.
- When the `Sink` finishes processing, the result is passed to the provided to the finalizer function.

Note that the `Sink` will stop receiving input as soon as the downstream it is connected to shuts down.

An example usage would be to write the result of a `Sink` to some mutable variable while allowing other processing to continue.

Since 1.1.0

sourceToList :: Monad m => ConduitT () a m () -> m [a] #

Convert a `Source` into a list. The basic functionality can be explained as:

    sourceToList src = src $$ Data.Conduit.List.consume

However, `sourceToList` is able to produce its results lazily, which cannot be done when running a conduit pipeline in general. Unlike the `Data.Conduit.Lazy` module (in conduit-extra), this function performs no unsafe I/O operations, and therefore can only be as lazy as the underlying monad.

Since 1.2.6

newtype SealedConduitT i o (m :: Type -> Type) r #

In order to provide for efficient monadic composition, the `ConduitT` type is implemented internally using a technique known as the codensity transform. This allows for cheap appending, but makes one case much more expensive: partially running a `ConduitT` and that capturing the new state.

This data type is the same as `ConduitT`, but does not use the codensity transform technique.

Since: 1.3.0

Constructors

SealedConduitT (Pipe i i o () m r) |

sealConduitT :: forall i o (m :: Type -> Type) r. ConduitT i o m r -> SealedConduitT i o m r #

unsealConduitT :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m r -> ConduitT i o m r #

($$+) :: Monad m => ConduitT () a m () -> ConduitT a Void m b -> m (SealedConduitT () a m (), b) infixr 0 #

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

Mnemonic: connect + do more.

Since 0.5.0

($$++) :: Monad m => SealedConduitT () a m () -> ConduitT a Void m b -> m (SealedConduitT () a m (), b) infixr 0 #

Continue processing after usage of `$$+`.

Since 0.5.0

($$+-) :: Monad m => SealedConduitT () a m () -> ConduitT a Void m b -> m b infixr 0 #

Same as `$$++` and `connectResume`, but doesn't include the updated `SealedConduitT`.

NOTE In previous versions, this would cause finalizers to run. Since version 1.3.0, there are no finalizers in conduit.

Since 0.5.0

($=+) :: forall (m :: Type -> Type) a b. Monad m => SealedConduitT () a m () -> ConduitT a b m () -> SealedConduitT () b m () infixl 1 #

Left fusion for a sealed source.

Since 1.0.16

(=$$+) :: forall (m :: Type -> Type) a b r. Monad m => ConduitT a b m () -> ConduitT b Void m r -> ConduitT a Void m (SealedConduitT a b m (), r) infixr 0 #

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.

Since 1.0.17

(=$$++) :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m (SealedConduitT i o m (), r) infixr 0 #

Continue processing after usage of `=$$+`. Connect a `SealedConduitT` to a sink and return the output of the sink together with a new `SealedConduitT`.

Since 1.0.17

(=$$+-) :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m r infixr 0 #

Same as `=$$++`, but doesn't include the updated `SealedConduitT`.

NOTE In previous versions, this would cause finalizers to run. Since version 1.3.0, there are no finalizers in conduit.

Since 1.0.17

fuseLeftovers :: forall (m :: Type -> Type) b a c r. Monad m => ([b] -> [a]) -> ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m r #

Similar to `fuseReturnLeftovers`, but use the provided function to convert downstream leftovers to upstream leftovers.

Since 1.0.17

fuseReturnLeftovers :: forall (m :: Type -> Type) a b c r. Monad m => ConduitT a b m () -> ConduitT b c m r -> ConduitT a c m (r, [b]) #

Same as normal fusion (e.g. `=$=`), except instead of discarding leftovers from the downstream component, return them.

Since 1.0.17

newtype ZipSource (m :: Type -> Type) o #

A wrapper for defining an `Applicative` instance for `Source`s which allows to combine sources together, generalizing `zipSources`. A combined source will take input yielded from each of its `Source`s until any of them stop producing output.

Since 1.0.13

Constructors

ZipSource |
Fields getZipSource :: ConduitT () o m ()

#### Instances

Instances details

Monad m => Applicative (ZipSource m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods pure :: a -> ZipSource m a # (<*>) :: ZipSource m (a -> b) -> ZipSource m a -> ZipSource m b # liftA2 :: (a -> b -> c) -> ZipSource m a -> ZipSource m b -> ZipSource m c # (*>) :: ZipSource m a -> ZipSource m b -> ZipSource m b # (<*) :: ZipSource m a -> ZipSource m b -> ZipSource m a #
Monad m => Functor (ZipSource m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods fmap :: (a -> b) -> ZipSource m a -> ZipSource m b # (<$) :: a -> ZipSource m b -> ZipSource m a #

sequenceSources :: forall f (m :: Type -> Type) o. (Traversable f, Monad m) => f (ConduitT () o m ()) -> ConduitT () (f o) m () #

Coalesce all values yielded by all of the `Source`s.

Implemented on top of `ZipSource` and as such, it exhibits the same short-circuiting behavior as `ZipSource`. See that data type for more details. If you want to create a source that yields *all* values from multiple sources, use `sequence_`.

Since 1.0.13

newtype ZipSink i (m :: Type -> Type) r #

A wrapper for defining an `Applicative` instance for `Sink`s which allows to combine sinks together, generalizing `zipSinks`. A combined sink distributes the input to all its participants and when all finish, produces the result. This allows to define functions like

    sequenceSinks :: (Monad m)
              => [ConduitT i Void m r] -> ConduitT i Void m [r]
    sequenceSinks = getZipSink . sequenceA . fmap ZipSink

Note that the standard `Applicative` instance for conduits works differently. It feeds one sink with input until it finishes, then switches to another, etc., and at the end combines their results.

This newtype is in fact a type constrained version of `ZipConduit`, and has the same behavior. It's presented as a separate type since (1) it historically predates `ZipConduit`, and (2) the type constraining can make your code clearer (and thereby make your error messages more easily understood).

Since 1.0.13

Constructors

ZipSink |
Fields getZipSink :: ConduitT i Void m r

#### Instances

Instances details

Monad m => Applicative (ZipSink i m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods pure :: a -> ZipSink i m a # (<*>) :: ZipSink i m (a -> b) -> ZipSink i m a -> ZipSink i m b # liftA2 :: (a -> b -> c) -> ZipSink i m a -> ZipSink i m b -> ZipSink i m c # (*>) :: ZipSink i m a -> ZipSink i m b -> ZipSink i m b # (<*) :: ZipSink i m a -> ZipSink i m b -> ZipSink i m a #
Monad m => Functor (ZipSink i m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods fmap :: (a -> b) -> ZipSink i m a -> ZipSink i m b # (<$) :: a -> ZipSink i m b -> ZipSink i m a #

sequenceSinks :: forall f (m :: Type -> Type) i r. (Traversable f, Monad m) => f (ConduitT i Void m r) -> ConduitT i Void m (f r) #

Send incoming values to all of the `Sink` providing, and ultimately coalesce together all return values.

Implemented on top of `ZipSink`, see that data type for more details.

Since 1.0.13

newtype ZipConduit i o (m :: Type -> Type) r #

Provides an alternative `Applicative` instance for `ConduitT`. In this instance, every incoming value is provided to all `ConduitT`s, and output is coalesced together. Leftovers from individual `ConduitT`s will be used within that component, and then discarded at the end of their computation. Output and finalizers will both be handled in a left-biased manner.

As an example, take the following program:

    main :: IO ()
    main = do
        let src = mapM_ yield [1..3 :: Int]
            conduit1 = CL.map (+1)
            conduit2 = CL.concatMap (replicate 2)
            conduit = getZipConduit $ ZipConduit conduit1 <* ZipConduit conduit2
            sink = CL.mapM_ print
        src $$ conduit =$ sink

It will produce the output: 2, 1, 1, 3, 2, 2, 4, 3, 3

Since 1.0.17

Constructors

ZipConduit |
Fields getZipConduit :: ConduitT i o m r

#### Instances

Instances details

Monad m => Applicative (ZipConduit i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods pure :: a -> ZipConduit i o m a # (<*>) :: ZipConduit i o m (a -> b) -> ZipConduit i o m a -> ZipConduit i o m b # liftA2 :: (a -> b -> c) -> ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m c # (*>) :: ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m b # (<*) :: ZipConduit i o m a -> ZipConduit i o m b -> ZipConduit i o m a #
Functor (ZipConduit i o m) # |
Instance details Defined in Data.Conduit.Internal.Conduit Methods fmap :: (a -> b) -> ZipConduit i o m a -> ZipConduit i o m b # (<$) :: a -> ZipConduit i o m b -> ZipConduit i o m a #

sequenceConduits :: forall f (m :: Type -> Type) i o r. (Traversable f, Monad m) => f (ConduitT i o m r) -> ConduitT i o m (f r) #

Provide identical input to all of the `Conduit`s and combine their outputs into a single stream.

Implemented on top of `ZipConduit`, see that data type for more details.

Since 1.0.17

connectResume :: Monad m => SealedConduitT () a m () -> ConduitT a Void m r -> m (SealedConduitT () a m (), r) #

Connect a `Source` to a `Sink` until the latter closes. Returns both the most recent state of the `Source` and the result of the `Sink`.

Since 0.5.0

connectResumeConduit :: forall (m :: Type -> Type) i o r. Monad m => SealedConduitT i o m () -> ConduitT o Void m r -> ConduitT i Void m (SealedConduitT i o m (), r) #

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

Since 1.0.17

sourceToPipe :: forall (m :: Type -> Type) o l i u. Monad m => ConduitT () o m () -> Pipe l i o u m () #

sinkToPipe :: forall (m :: Type -> Type) i r l o u. Monad m => ConduitT i Void m r -> Pipe l i o u m r #

conduitToPipe :: forall (m :: Type -> Type) i o l u. Monad m => ConduitT i o m () -> Pipe l i o u m () #

zipSinks :: forall (m :: Type -> Type) i r r'. Monad m => ConduitT i Void m r -> ConduitT i Void m r' -> ConduitT i Void m (r, r') #

Combines two sinks. The new sink will complete when both input sinks have completed.

Any leftovers are discarded.

Since 0.4.1

zipSources :: forall (m :: Type -> Type) a b. Monad m => ConduitT () a m () -> ConduitT () b m () -> ConduitT () (a, b) m () #

Combines two sources. The new source will stop producing once either source has been exhausted.

Since 1.0.13

zipSourcesApp :: forall (m :: Type -> Type) a b. Monad m => ConduitT () (a -> b) m () -> ConduitT () a m () -> ConduitT () b m () #

Combines two sources. The new source will stop producing once either source has been exhausted.

Since 1.0.13

zipConduitApp :: forall (m :: Type -> Type) i o x y. Monad m => ConduitT i o m (x -> y) -> ConduitT i o m x -> ConduitT i o m y #

Since 1.0.17

# Fusion (highly experimental!!!)

module Data.Conduit.Internal.Fusion