Pipes is actually bi directional. However most common usage of pipes
is unidirectional where elements flow downstream.
When you have a unidirectional pipe what is actually happening is you
are sending elements downstream, and then you are sending () upstream
when you want another chunk. The unidirectional pipe upstream from
you gets that () and uses that as a signal to send its next chunk back
downstream.
await and yield are actually implemented using the bidirectional pipe
functions request and respond. You can see this in the source where
they are defined as such:
yield :: Monad m => a -> Producer' a m ()
yield = respond
await :: Monad m => Consumer' a m a
await = request ()
Where respond takes the element sent downstream, and returns ().
Await sends () upstream and returns an element.
>> > email to
haskell-pipe...@googlegroups.com.
>>
haskell-pipe...@googlegroups.com.
> You received this message because you are subscribed to the Google Groups
> "Haskell Pipes" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
haskell-pipe...@googlegroups.com.