streamly-0.8.3: Dataflow programming and declarative concurrency
Copyright(c) 2019 Composewell Technologies
LicenseBSD3
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Data.Pipe

Description

There are three fundamental types in streamly. They are streams (Streamly.Prelude), pipes (Streamly.Internal.Data.Pipe) and folds (Streamly.Data.Fold). Streams are sources or producers of values, multiple sources can be merged into a single source but a source cannot be split into multiple stream sources. Folds are sinks or consumers, a stream can be split and distributed to multiple folds but the results cannot be merged back into a stream source again. Pipes are transformations, a stream source can be split and distributed to multiple pipes each pipe can apply its own transform on the stream and the results can be merged back into a single pipe. Pipes can be attached to a source to produce a source or they can be attached to a fold to produce a fold, or multiple pipes can be merged or zipped into a single pipe.

import qualified Streamly.Internal.Data.Pipe as Pipe
Synopsis

Pipe Type

data Pipe m a b Source #

Instances

Instances details
Monad m => Category (Pipe m :: Type -> Type -> Type) Source # 
Instance details

Defined in Streamly.Internal.Data.Pipe.Type

Methods

id :: forall (a :: k). Pipe m a a #

(.) :: forall (b :: k) (c :: k) (a :: k). Pipe m b c -> Pipe m a b -> Pipe m a c #

Monad m => Arrow (Pipe m) Source # 
Instance details

Defined in Streamly.Internal.Data.Pipe.Type

Methods

arr :: (b -> c) -> Pipe m b c #

first :: Pipe m b c -> Pipe m (b, d) (c, d) #

second :: Pipe m b c -> Pipe m (d, b) (d, c) #

(***) :: Pipe m b c -> Pipe m b' c' -> Pipe m (b, b') (c, c') #

(&&&) :: Pipe m b c -> Pipe m b c' -> Pipe m b (c, c') #

Monad m => Applicative (Pipe m a) Source # 
Instance details

Defined in Streamly.Internal.Data.Pipe.Type

Methods

pure :: a0 -> Pipe m a a0 #

(<*>) :: Pipe m a (a0 -> b) -> Pipe m a a0 -> Pipe m a b #

liftA2 :: (a0 -> b -> c) -> Pipe m a a0 -> Pipe m a b -> Pipe m a c #

(*>) :: Pipe m a a0 -> Pipe m a b -> Pipe m a b #

(<*) :: Pipe m a a0 -> Pipe m a b -> Pipe m a a0 #

Monad m => Functor (Pipe m a) Source # 
Instance details

Defined in Streamly.Internal.Data.Pipe.Type

Methods

fmap :: (a0 -> b) -> Pipe m a a0 -> Pipe m a b #

(<$) :: a0 -> Pipe m a b -> Pipe m a a0 #

Monad m => Semigroup (Pipe m a b) Source # 
Instance details

Defined in Streamly.Internal.Data.Pipe.Type

Methods

(<>) :: Pipe m a b -> Pipe m a b -> Pipe m a b #

sconcat :: NonEmpty (Pipe m a b) -> Pipe m a b #

stimes :: Integral b0 => b0 -> Pipe m a b -> Pipe m a b #

Pipes

Mapping

map :: Monad m => (a -> b) -> Pipe m a b Source #

Lift a pure function to a Pipe.

Since: 0.7.0

mapM :: Monad m => (a -> m b) -> Pipe m a b Source #

Lift a monadic function to a Pipe.

Since: 0.7.0

Composing Pipes

tee :: Monad m => Pipe m a b -> Pipe m a b -> Pipe m a b Source #

The composed pipe distributes the input to both the constituent pipes and merges the outputs of the two.

Since: 0.7.0

zipWith :: Monad m => (a -> b -> c) -> Pipe m i a -> Pipe m i b -> Pipe m i c Source #

The composed pipe distributes the input to both the constituent pipes and zips the output of the two using a supplied zipping function.

Since: 0.7.0

compose :: Monad m => Pipe m b c -> Pipe m a b -> Pipe m a c Source #

Compose two pipes such that the output of the second pipe is attached to the input of the first pipe.

Since: 0.7.0