Safe Haskell | Safe-Infered |
---|
This module contains an alternative pipe implementation, PutbackPipe
,
providing an additional primitive putback
, which allows data to be
inserted into the input stream of the current pipe.
PutbackPipes can be used to implement pipes with left-over data, and can be composed vertically (using the Monad instance), but not horizontally.
To make use of a PutbackPipe within a Pipeline
, you need to convert it to
a regular Pipe
using runPutback
.
- newtype PutbackPipe a b m r = PutbackPipe {}
- fromPipe :: Monad m => Pipe a b m r -> PutbackPipe a b m r
- putback :: Monad m => a -> PutbackPipe a b m ()
- yield :: Monad m => b -> PutbackPipe a b m ()
- await :: Monad m => PutbackPipe a b m a
- tryAwait :: Monad m => PutbackPipe a b m (Maybe a)
- runPutback :: Monad m => PutbackPipe a b m r -> Pipe a b m r
Documentation
newtype PutbackPipe a b m r Source
The PutbackPipe
data type.
MonadTrans (PutbackPipe a b) | |
Monad m => Monad (PutbackPipe a b m) | |
Monad m => Functor (PutbackPipe a b m) | |
Monad m => Applicative (PutbackPipe a b m) | |
MonadIO m => MonadIO (PutbackPipe a b m) |
fromPipe :: Monad m => Pipe a b m r -> PutbackPipe a b m rSource
Create a PutbackPipe
from a regular pipe.
putback :: Monad m => a -> PutbackPipe a b m ()Source
Put back an element into the input stream.
await :: Monad m => PutbackPipe a b m aSource
Same as await
for regular pipes.
runPutback :: Monad m => PutbackPipe a b m r -> Pipe a b m rSource
Convert a PutbackPipe
to a regular pipe.