top-0.2.4: Top (typed oriented protocol) API

Safe HaskellNone
LanguageHaskell2010

Network.Top.Pipes

Contents

Description

Access Top connections as Pipes

Synopsis

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

(>->) infixl 7 #

Arguments

:: Monad m 
=> Proxy a' a () b m r 
-> Proxy () b c' c m r 
-> Proxy a' a c' c m r 

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.

yield :: Monad m => a -> Producer' a m () #

Produce a value

yield :: Monad m => a -> Pipe x a m ()

for #

Arguments

:: Monad m 
=> Proxy x' x b' b m a' 
-> (b -> Proxy x' x c' c m b') 
-> Proxy x' x c' c m a' 

(for p body) loops over p replacing each yield with body.

for :: Monad m => Producer b m r -> (b -> Effect       m ()) -> Effect       m r
for :: Monad m => Producer b m r -> (b -> Producer   c m ()) -> Producer   c m r
for :: Monad m => Pipe   x b m r -> (b -> Consumer x   m ()) -> Consumer x   m r
for :: 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.

await :: Monad m => Consumer' a m a #

Consume a value

await :: Monad m => Pipe a y m a

lift :: MonadTrans t => forall m a. Monad m => m a -> t m a #

Lift a computation from the argument monad to the constructed monad.