Safe Haskell | None |
---|---|
Language | Haskell2010 |
Access Top connections as Pipes
- pipeIn :: (Show a, MonadIO m, Flat a) => Connection a -> Producer a m ()
- pipeOut :: (Show a, MonadIO m, Flat a) => Connection a -> Consumer a m ()
- runEffect :: Monad m => Effect m r -> m r
- (>->) :: Monad m => Proxy a' a () b m r -> Proxy () b c' c m r -> Proxy a' a c' c m r
- yield :: Monad m => a -> Producer' a m ()
- for :: Monad m => Proxy x' x b' b m a' -> (b -> Proxy x' x c' c m b') -> Proxy x' x c' c m a'
- await :: Monad m => Consumer' a m a
- lift :: MonadTrans t => forall m a. Monad m => m a -> t m a
Documentation
pipeIn :: (Show a, MonadIO m, Flat a) => Connection a -> Producer a m () Source #
Receive values from a typed connection, terminate when connection is closed
pipeOut :: (Show a, MonadIO m, Flat a) => Connection a -> Consumer a m () Source #
Send values on a typed connection, terminate when connection is closed
Re-exports from Pipe
runEffect :: Monad m => Effect m r -> m r #
Run a self-contained Effect
, converting it back to the base monad
Pipe
composition, analogous to the Unix pipe operator
(>->
) ::Monad
m =>Producer
b m r ->Consumer
b m r ->Effect
m r (>->
) ::Monad
m =>Producer
b m r ->Pipe
b c m r ->Producer
c m r (>->
) ::Monad
m =>Pipe
a b m r ->Consumer
b m r ->Consumer
a m r (>->
) ::Monad
m =>Pipe
a b m r ->Pipe
b c m r ->Pipe
a c m r
The following diagrams show the flow of information:
+-----------+ +-----------+ +-------------+
| | | | | |
| | | | | |
a ==> f ==> b ==> g ==> c = a ==> f >->
g ==> c
| | | | | |
| | | | | | | | |
+-----|-----+ +-----|-----+ +------|------+
v v v
r r r
For a more complete diagram including bidirectional flow, see Pipes.Core.
(for p body)
loops over p
replacing each yield
with body
.
for
::Monad
m =>Producer
b m r -> (b ->Effect
m ()) ->Effect
m rfor
::Monad
m =>Producer
b m r -> (b ->Producer
c m ()) ->Producer
c m rfor
::Monad
m =>Pipe
x b m r -> (b ->Consumer
x m ()) ->Consumer
x m rfor
::Monad
m =>Pipe
x b m r -> (b ->Pipe
x c m ()) ->Pipe
x c m r
The following diagrams show the flow of information:
.---> b
/ |
+-----------+ / +-----|-----+ +---------------+
| | / | v | | |
| | / | | | |
x ==> p ==> b ---' x ==> body ==> c = x ==> for
p body ==> c
| | | | | |
| | | | | | | | |
+-----|-----+ +-----|-----+ +-------|-------+
v v v
r () r
For a more complete diagram including bidirectional flow, see Pipes.Core.
lift :: MonadTrans t => forall m a. Monad m => m a -> t m a #
Lift a computation from the argument monad to the constructed monad.