foundation-0.0.19: Alternative prelude with batteries and no dependencies

Safe HaskellNone
LanguageHaskell2010

Foundation.Conduit

Synopsis

Documentation

data Conduit input output monad result Source #

A component of a conduit pipeline, which takes a stream of input, produces a stream of output, performs actions in the underlying monad, and produces a value of result when no more output data is available.

Instances

MonadTrans (Conduit i o) Source # 

Methods

lift :: AMPMonad m => m a -> Conduit i o m a Source #

Monad (Conduit i o m) Source # 

Methods

(>>=) :: Conduit i o m a -> (a -> Conduit i o m b) -> Conduit i o m b #

(>>) :: Conduit i o m a -> Conduit i o m b -> Conduit i o m b #

return :: a -> Conduit i o m a #

fail :: String -> Conduit i o m a #

Functor (Conduit i o m) Source # 

Methods

fmap :: (a -> b) -> Conduit i o m a -> Conduit i o m b #

(<$) :: a -> Conduit i o m b -> Conduit i o m a #

Applicative (Conduit i o m) Source # 

Methods

pure :: a -> Conduit i o m a #

(<*>) :: Conduit i o m (a -> b) -> Conduit i o m a -> Conduit i o m b #

liftA2 :: (a -> b -> c) -> Conduit i o m a -> Conduit i o m b -> Conduit i o m c #

(*>) :: Conduit i o m a -> Conduit i o m b -> Conduit i o m b #

(<*) :: Conduit i o m a -> Conduit i o m b -> Conduit i o m a #

MonadIO m => MonadIO (Conduit i o m) Source # 

Methods

liftIO :: IO a -> Conduit i o m a #

MonadFailure m => MonadFailure (Conduit i o m) Source # 

Associated Types

type Failure (Conduit i o m :: * -> *) :: * #

Methods

mFail :: Failure (Conduit i o m) -> Conduit i o m () #

MonadCatch m => MonadCatch (Conduit i o m) Source # 

Methods

catch :: Exception e => Conduit i o m a -> (e -> Conduit i o m a) -> Conduit i o m a Source #

MonadThrow m => MonadThrow (Conduit i o m) Source # 

Methods

throw :: Exception e => e -> Conduit i o m a Source #

type Failure (Conduit i o m) Source # 
type Failure (Conduit i o m) = Failure m

data ResourceT m a Source #

Instances

MonadTrans ResourceT Source # 

Methods

lift :: AMPMonad m => m a -> ResourceT m a Source #

Monad m => Monad (ResourceT m) Source # 

Methods

(>>=) :: ResourceT m a -> (a -> ResourceT m b) -> ResourceT m b #

(>>) :: ResourceT m a -> ResourceT m b -> ResourceT m b #

return :: a -> ResourceT m a #

fail :: String -> ResourceT m a #

Functor m => Functor (ResourceT m) Source # 

Methods

fmap :: (a -> b) -> ResourceT m a -> ResourceT m b #

(<$) :: a -> ResourceT m b -> ResourceT m a #

Applicative m => Applicative (ResourceT m) Source # 

Methods

pure :: a -> ResourceT m a #

(<*>) :: ResourceT m (a -> b) -> ResourceT m a -> ResourceT m b #

liftA2 :: (a -> b -> c) -> ResourceT m a -> ResourceT m b -> ResourceT m c #

(*>) :: ResourceT m a -> ResourceT m b -> ResourceT m b #

(<*) :: ResourceT m a -> ResourceT m b -> ResourceT m a #

MonadIO m => MonadIO (ResourceT m) Source # 

Methods

liftIO :: IO a -> ResourceT m a #

MonadBracket m => MonadBracket (ResourceT m) Source # 

Methods

generalBracket :: ResourceT m a -> (a -> b -> ResourceT m ignored1) -> (a -> SomeException -> ResourceT m ignored2) -> (a -> ResourceT m b) -> ResourceT m b Source #

MonadCatch m => MonadCatch (ResourceT m) Source # 

Methods

catch :: Exception e => ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a Source #

MonadThrow m => MonadThrow (ResourceT m) Source # 

Methods

throw :: Exception e => e -> ResourceT m a Source #

newtype ZipSink i m r Source #

Constructors

ZipSink 

Fields

Instances

Monad m => Functor (ZipSink i m) Source # 

Methods

fmap :: (a -> b) -> ZipSink i m a -> ZipSink i m b #

(<$) :: a -> ZipSink i m b -> ZipSink i m a #

Monad m => Applicative (ZipSink i m) Source # 

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 #

await :: Conduit i o m (Maybe i) Source #

Await for a value from upstream.

awaitForever :: (input -> Conduit input output monad b) -> Conduit input output monad () Source #

yield :: Monad m => o -> Conduit i o m () Source #

Send a value downstream.

yields :: (Monad m, Foldable os, Element os ~ o) => os -> Conduit i o m () Source #

Send values downstream.

yieldOr Source #

Arguments

:: o 
-> m ()

finalizer

-> Conduit i o m () 

Same as yield, but additionally takes a finalizer to be run if the downstream component terminates.

leftover :: i -> Conduit i o m () Source #

Provide leftover input to be consumed by the next component in the current monadic binding.

runConduit :: Monad m => Conduit () () m r -> m r Source #

Run a conduit pipeline to completion.

runConduitPure :: Conduit () () Identity r -> r Source #

Run a pure conduit pipeline to completion.

runConduitRes :: (MonadBracket m, MonadIO m) => Conduit () () (ResourceT m) r -> m r Source #

Run a conduit pipeline in a ResourceT context for acquiring resources.

fuse :: Monad m => Conduit a b m () -> Conduit b c m r -> Conduit a c m r Source #

Send the output of the first Conduit component to the second Conduit component.

(.|) :: Monad m => Conduit a b m () -> Conduit b c m r -> Conduit a c m r infixr 2 Source #

Operator version of fuse.

sourceFile :: MonadResource m => FilePath -> Conduit i (UArray Word8) m () Source #

sinkFile :: MonadResource m => FilePath -> Conduit (UArray Word8) i m () Source #

sinkList :: Monad m => Conduit i o m [i] Source #

bracketConduit :: MonadResource m => IO a -> (a -> IO b) -> (a -> Conduit i o m r) -> Conduit i o m r Source #