Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Piped.Internal
Contents
Description
The internal API and core datatypes of Pipe.
Synopsis
- newtype Pipe i o m a = Pipe {}
- await :: Monad m => Pipe i o m (Maybe i)
- yield :: o -> Pipe i o m ()
- runPipe :: Monad m => Pipe () Void m r -> m r
- leftover :: i -> Pipe i o m ()
- newtype Await i m a = Await {}
- data Yield i m a = Yield {}
- type Await' i m a = Yield i m a -> m a
- type Yield' i m a = i -> Await i m a -> m a
- runAwait :: Await i m a -> m a -> Yield' i m a -> m a
- runYield :: Yield i m a -> i -> Await' i m a -> m a
- termLeft :: Await i m a
- termRight :: Yield i1 m a -> Yield i2 m a
- voidRight :: Yield Void m a
- addLeftover :: i -> Await i m a -> Await i m a
- data Void
- fix1 :: a -> ((a -> b) -> a -> b) -> b
- fix2 :: a -> b -> ((a -> b -> c) -> a -> b -> c) -> c
Pipe
Piped is implemented using a type of codensity transform, that uses left and right continuations, rather than sum types, to propagate state transitions.
The Pipe datatype, that represents a stage in a pipeline with inputs of type i
and outputs of type o
.
Constructors
Pipe | |
Instances
MonadState s m => MonadState s (Pipe i o m) Source # | |
MonadReader r m => MonadReader r (Pipe i o m) Source # | |
MonadTrans (Pipe i o) Source # | |
Defined in Piped.Internal | |
Monad m => Monad (Pipe i o m) Source # | |
Monad m => Functor (Pipe i o m) Source # | |
Monad m => Applicative (Pipe i o m) Source # | |
Defined in Piped.Internal | |
MonadIO m => MonadIO (Pipe i o m) Source # | |
Defined in Piped.Internal | |
Monad m => Semigroup (Pipe i o m a) Source # | |
Monad m => Monoid (Pipe i o m ()) Source # | |
await :: Monad m => Pipe i o m (Maybe i) Source #
Await a value. Nothing indicates that there are no more values.
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
.
The upstream continuation; holds a callback that provides a value.
The downstream continuation; holds a callback that accepts a value, plus a default return value in case there is no more input.
addLeftover :: i -> Await i m a -> Await i m a Source #
Wrap an Await with a leftover value
Uninhabited data type
Since: base-4.8.0.0
Instances
Eq Void | Since: base-4.8.0.0 |
Data Void | Since: base-4.8.0.0 |
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 # 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 |
Read Void | Reading a Since: base-4.8.0.0 |
Show Void | Since: base-4.8.0.0 |
Ix Void | Since: base-4.8.0.0 |
Generic Void | |
Semigroup Void | Since: base-4.9.0.0 |
Exception Void | Since: base-4.8.0.0 |
Defined in Data.Void Methods toException :: Void -> SomeException # fromException :: SomeException -> Maybe Void # displayException :: Void -> String # | |
type Rep Void | Since: base-4.8.0.0 |