Foundation.Conduit

foundation-0.0.30: Alternative prelude with batteries and no dependencies

Safe Haskell | None
Language | Haskell2010

Foundation.Conduit

Synopsis

- data Conduit input output (monad :: Type -> Type) result
- data ResourceT (m :: Type -> Type) a
- newtype ZipSink i (m :: Type -> Type) r = ZipSink {
  - getZipSink :: Conduit i () m r
  }
- await :: forall i o (m :: Type -> Type). Conduit i o m (Maybe i)
- awaitForever :: forall input output (monad :: Type -> Type) b. (input -> Conduit input output monad b) -> Conduit input output monad ()
- yield :: forall (m :: Type -> Type) o i. Monad m => o -> Conduit i o m ()
- yields :: forall (m :: Type -> Type) os o i. (Monad m, Foldable os, Element os ~ o) => os -> Conduit i o m ()
- yieldOr :: o -> m () -> Conduit i o m ()
- leftover :: forall i o (m :: Type -> Type). i -> Conduit i o m ()
- runConduit :: Monad m => Conduit () () m r -> m r
- runConduitPure :: Conduit () () Identity r -> r
- runConduitRes :: (MonadBracket m, MonadIO m) => Conduit () () (ResourceT m) r -> m r
- fuse :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a b m () -> Conduit b c m r -> Conduit a c m r
- (.|) :: forall (m :: Type -> Type) a b c r. Monad m => Conduit a b m () -> Conduit b c m r -> Conduit a c m r
- sourceFile :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> Conduit i (UArray Word8) m ()
- sourceHandle :: forall (m :: Type -> Type) i. MonadIO m => Handle -> Conduit i (UArray Word8) m ()
- sinkFile :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> Conduit (UArray Word8) i m ()
- sinkHandle :: forall (m :: Type -> Type) o. MonadIO m => Handle -> Conduit (UArray Word8) o m ()
- sinkList :: forall (m :: Type -> Type) i o. Monad m => Conduit i o m [i]
- bracketConduit :: forall (m :: Type -> Type) a b i o r. MonadResource m => IO a -> (a -> IO b) -> (a -> Conduit i o m r) -> Conduit i o m r

# Documentation

data Conduit input output (monad :: Type -> Type) result #

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

Instances details

MonadTrans (Conduit i o) # |
Instance details Defined in Foundation.Conduit.Internal Methods lift :: Monad m => m a -> Conduit i o m a #
MonadIO m => MonadIO (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal Methods liftIO :: IO a -> Conduit i o m a #
MonadFailure m => MonadFailure (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal Associated Types
type Failure (Conduit i o m) |
Instance details Defined in Foundation.Conduit.Internal type Failure (Conduit i o m) = Failure m
Methods mFail :: Failure (Conduit i o m) -> Conduit i o m () #
MonadCatch m => MonadCatch (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal Methods catch :: Exception e => Conduit i o m a -> (e -> Conduit i o m a) -> Conduit i o m a #
MonadThrow m => MonadThrow (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal Methods throw :: Exception e => e -> Conduit i o m a #
Applicative (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal 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 #
Functor (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal 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 #
Monad (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal 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 #
type Failure (Conduit i o m) # |
Instance details Defined in Foundation.Conduit.Internal type Failure (Conduit i o m) = Failure m

data ResourceT (m :: Type -> Type) a #

#### Instances

Instances details

MonadTrans ResourceT # |
Instance details Defined in Foundation.Conduit.Internal Methods lift :: Monad m => m a -> ResourceT m a #
MonadIO m => MonadIO (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal Methods liftIO :: IO a -> ResourceT m a #
MonadBracket m => MonadBracket (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal Methods generalBracket :: ResourceT m a -> (a -> b -> ResourceT m ignored1) -> (a -> SomeException -> ResourceT m ignored2) -> (a -> ResourceT m b) -> ResourceT m b #
MonadCatch m => MonadCatch (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal Methods catch :: Exception e => ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a #
MonadThrow m => MonadThrow (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal Methods throw :: Exception e => e -> ResourceT m a #
Applicative m => Applicative (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal 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 #
Functor m => Functor (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal Methods fmap :: (a -> b) -> ResourceT m a -> ResourceT m b # (<$) :: a -> ResourceT m b -> ResourceT m a #
Monad m => Monad (ResourceT m) # |
Instance details Defined in Foundation.Conduit.Internal 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 #

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

Constructors

ZipSink |
Fields getZipSink :: Conduit i () m r

#### Instances

Instances details

Monad m => Applicative (ZipSink i m) # |
Instance details Defined in Foundation.Conduit.Internal 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 Foundation.Conduit.Internal Methods fmap :: (a -> b) -> ZipSink i m a -> ZipSink i m b # (<$) :: a -> ZipSink i m b -> ZipSink i m a #

await :: forall i o (m :: Type -> Type). Conduit i o m (Maybe i) #

Await for a value from upstream.

awaitForever :: forall input output (monad :: Type -> Type) b. (input -> Conduit input output monad b) -> Conduit input output monad () #

yield :: forall (m :: Type -> Type) o i. Monad m => o -> Conduit i o m () #

Send a value downstream.

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

Send values downstream.

yieldOr #

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 :: forall i o (m :: Type -> Type). i -> Conduit i o m () #

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

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

Run a conduit pipeline to completion.

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

Run a pure conduit pipeline to completion.

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

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

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

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

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

Operator version of `fuse`.

sourceFile :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> Conduit i (UArray Word8) m () #

sourceHandle :: forall (m :: Type -> Type) i. MonadIO m => Handle -> Conduit i (UArray Word8) m () #

sinkFile :: forall (m :: Type -> Type) i. MonadResource m => FilePath -> Conduit (UArray Word8) i m () #

sinkHandle :: forall (m :: Type -> Type) o. MonadIO m => Handle -> Conduit (UArray Word8) o m () #

sinkList :: forall (m :: Type -> Type) i o. Monad m => Conduit i o m [i] #

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