-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Monad to ease implementing a binary network protocol over ZeroMQ
--
-- The monad provided in this package provides an easy way to implement
-- servers and clients which exchange messages (types which are instances
-- of Data.Binary.Binary) over ZeroMQ sockets.
--
-- This is heavily based on the Control.Monad.BinaryProtocol
-- package by Gregory Crosswhite.
@package binary-protocol-zmq
@version 0.2
-- | Monad to ease implementing a binary network protocol over ZeroMQ
module Control.Monad.BinaryProtocol.ZMQ
-- | Action type definition. a is the type of the reader ZeroMQ
-- socket, b is the type of the writer ZeroMQ socket, and
-- c is the return type of the action.
data BinaryProtocol a b c
-- | Take a BinaryProtocol action and run it on the given ZeroMQ
-- sockets for respectively reading and writing. The two given handles
-- are allowed to be the same if the same handle is used for reading and
-- writing.
--
-- Since ZeroMQ sockets are not thread-safe (unlike a Context object),
-- make sure you use any socket you create in the OS thread it was
-- created in only. Use forkOS where necessary.
runProtocol :: BinaryProtocol a b c -> Socket a -> Socket b -> IO c
-- | Read in a value of type c from the connection; c
-- must be an instance of the Binary class. This is a wrapper
-- around receive', not passing any flags.
receive :: Binary c => BinaryProtocol a b c
-- | Read in a value of type c from the connection; c
-- must be an instance of the Binary class. A list of
-- Flags can be given.
receive' :: Binary c => [Flag] -> BinaryProtocol a b c
-- | Send a value of type c down the connection; c must
-- be an instance of the Binary class. This is a wrapper aroung
-- send', not passing any flags.
send :: Binary c => c -> BinaryProtocol a b ()
-- | Send a value of type c down the connection; c must
-- be an instance of the Binary class. A list of Flags
-- can be given.
send' :: Binary c => [Flag] -> c -> BinaryProtocol a b ()
-- | Flush connections
--
-- Note: this is a no-op, provided for API compatibility with the
-- Control.Monad.BinaryProtocol package.
flush :: BinaryProtocol a b ()
instance Monad (BinaryProtocol a b)
instance MonadIO (BinaryProtocol a b)
instance MonadReader (Socket a, Socket b) (BinaryProtocol a b)