daemons-0.1.0: Daemons in Haskell made fun and easy  Safe
HaskellSafe-Infered     Socket pipes  socketReader :: MonadIO m
=> Socket -> Producer ByteString m ()Source  Stream data from
the socket.  socketWriter :: MonadIO m => Socket -> Consumer
ByteString m ()Source  Stream data to the socket.  Socket
server/client  type Handler r = Producer ByteString IO () ->
Consumer ByteString IO () -> IO rSource  A simple handler: takes
an incoming stream of ByteStrings, an stream of ByteStrings, and
ties them together somehow. Conceptually, the simplest handler
would be identity:   import Control.Monad  import Control.Pipe
import Data.ByteString.Char8   handler reader writer = do
let identity = forever $ do          x <- await          yield x
runPipe (writer <+< identity <+< reader)  See the pipes tutorial
for more examples of writing pipes.  Since ByteStrings are
fairly boring by themseleves, have a look at
Control.Pipe.Serialize which lets you deserialize/serialize
pipes of ByteStrings easily.  runSocketSe