piped-0.1.0.0: Conduit with a smaller core

Safe HaskellSafe
LanguageHaskell2010

Piped.Internal

Contents

Description

The internal API and core datatypes of Pipe.

Synopsis

Pipe

Piped is implemented using a type of codensity transform, that uses left and right continuations, rather than sum types, to propagate state transitions.

newtype Pipe i o m a Source #

The Pipe datatype, that represents a stage in a pipeline with inputs of type i and outputs of type o.

Constructors

Pipe 

Fields

Instances
MonadState s m => MonadState s (Pipe i o m) Source # 
Instance details

Defined in Piped.Internal

Methods

get :: Pipe i o m s #

put :: s -> Pipe i o m () #

state :: (s -> (a, s)) -> Pipe i o m a #

MonadReader r m => MonadReader r (Pipe i o m) Source # 
Instance details

Defined in Piped.Internal

Methods

ask :: Pipe i o m r #

local :: (r -> r) -> Pipe i o m a -> Pipe i o m a #

reader :: (r -> a) -> Pipe i o m a #

MonadTrans (Pipe i o) Source # 
Instance details

Defined in Piped.Internal

Methods

lift :: Monad m => m a -> Pipe i o m a #

Monad m => Monad (Pipe i o m) Source # 
Instance details

Defined in Piped.Internal

Methods

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

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

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

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

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

Defined in Piped.Internal

Methods

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

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

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

Defined in Piped.Internal

Methods

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

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

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

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

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

MonadIO m => MonadIO (Pipe i o m) Source # 
Instance details

Defined in Piped.Internal

Methods

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

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

Defined in Piped.Internal

Methods

(<>) :: Pipe i o m a -> Pipe i o m a -> Pipe i o m a #

sconcat :: NonEmpty (Pipe i o m a) -> Pipe i o m a #

stimes :: Integral b => b -> Pipe i o m a -> Pipe i o m a #

Monad m => Monoid (Pipe i o m ()) Source # 
Instance details

Defined in Piped.Internal

Methods

mempty :: Pipe i o m () #

mappend :: Pipe i o m () -> Pipe i o m () -> Pipe i o m () #

mconcat :: [Pipe i o m ()] -> Pipe i o m () #

await :: Monad m => Pipe i o m (Maybe i) Source #

Await a value. Nothing indicates that there are no more values.

yield :: o -> Pipe i o m () Source #

Yield a value to downstream.

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

Run pipe to completion.

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

Push a value back into the incoming pipeline

Continuations

The state of a pipeline is encoded in a recursive data structure (Await / Yield) which holds continuations that promise a final return value of r.

newtype Await i m a Source #

The upstream continuation; holds a callback that provides a value.

Constructors

Await 

Fields

data Yield i m a Source #

The downstream continuation; holds a callback that accepts a value, plus a default return value in case there is no more input.

Constructors

Yield 

Fields

type Await' i m a = Yield i m a -> m a Source #

The type of an upstream continuation

type Yield' i m a = i -> Await i m a -> m a Source #

The type of a downstream continuation

runAwait :: Await i m a -> m a -> Yield' i m a -> m a Source #

Run an Await

runYield :: Yield i m a -> i -> Await' i m a -> m a Source #

Run a Yield

termLeft :: Await i m a Source #

An Await that terminates when called.

termRight :: Yield i1 m a -> Yield i2 m a Source #

A Yield that terminates when called.

voidRight :: Yield Void m a Source #

A Void output

addLeftover :: i -> Await i m a -> Await i m a Source #

Wrap an Await with a leftover value

data Void #

Uninhabited data type

Since: base-4.8.0.0

Instances
Eq Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Methods

(==) :: Void -> Void -> Bool #

(/=) :: Void -> Void -> Bool #

Data Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Void -> c Void #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Void #

toConstr :: Void -> Constr #

dataTypeOf :: Void -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Void) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Void) #

gmapT :: (forall b. Data b => b -> b) -> Void -> Void #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Void -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Void -> r #

gmapQ :: (forall d. Data d => d -> u) -> Void -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Void -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Void -> m Void #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Void -> m Void #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Void -> m Void #

Ord Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Methods

compare :: Void -> Void -> Ordering #

(<) :: Void -> Void -> Bool #

(<=) :: Void -> Void -> Bool #

(>) :: Void -> Void -> Bool #

(>=) :: Void -> Void -> Bool #

max :: Void -> Void -> Void #

min :: Void -> Void -> Void #

Read Void

Reading a Void value is always a parse error, considering Void as a data type with no constructors.

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Show Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Methods

showsPrec :: Int -> Void -> ShowS #

show :: Void -> String #

showList :: [Void] -> ShowS #

Ix Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

Methods

range :: (Void, Void) -> [Void] #

index :: (Void, Void) -> Void -> Int #

unsafeIndex :: (Void, Void) -> Void -> Int

inRange :: (Void, Void) -> Void -> Bool #

rangeSize :: (Void, Void) -> Int #

unsafeRangeSize :: (Void, Void) -> Int

Generic Void 
Instance details

Defined in Data.Void

Associated Types

type Rep Void :: Type -> Type #

Methods

from :: Void -> Rep Void x #

to :: Rep Void x -> Void #

Semigroup Void

Since: base-4.9.0.0

Instance details

Defined in Data.Void

Methods

(<>) :: Void -> Void -> Void #

sconcat :: NonEmpty Void -> Void #

stimes :: Integral b => b -> Void -> Void #

Exception Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

type Rep Void

Since: base-4.8.0.0

Instance details

Defined in Data.Void

type Rep Void = D1 (MetaData "Void" "Data.Void" "base" False) (V1 :: Type -> Type)

Miscellania

fix1 :: a -> ((a -> b) -> a -> b) -> b Source #

fix2 :: a -> b -> ((a -> b -> c) -> a -> b -> c) -> c Source #