-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Flexible way to ease transmission of binary data.
--
-- Simple datatype that makes easier to send and receive values in any
-- MonadIO. Inspired by Gregory Crosswhite's 'binary-protocol' package.
@package binary-communicator
@version 1.0.2.1
-- | Binary Communicator
--
-- This module provides the datatype BinaryCom, which enables you to
-- easily send and receive data to and from a binary source. The
-- transmitted data can be an instance of the Binary class, or
-- you can provide your own Put and Get actions to serialize and parse
-- the binary stream.
module Data.BinaryCom
-- | BinaryCom type
data BinaryCom
-- | Creates a BinaryCom from a Handle opened for both
-- reading and writing. Be careful not to use the handle afterwards
binaryCom :: MonadIO m => Handle -> m BinaryCom
-- | Creates a BinaryCom from two Handles: one for reading,
-- one for writing
binaryCom2H :: MonadIO m => Handle -> Handle -> m BinaryCom
-- | Creates a BinaryCom from a lazy ByteString (for reading)
-- and a Handle (for writing)
binaryComBS :: MonadIO m => ByteString -> Handle -> m BinaryCom
-- | Sends a serializable value through a BinaryCom
send :: (Binary a, MonadIO m) => BinaryCom -> a -> m ()
-- | Runs a continuation, passing it a binary com with auto-flush
-- deactivated. Flushes when the continuation is finished. It permits not
-- to flush at each call to send.
flushAfter :: MonadIO m => BinaryCom -> (BinaryCom -> m ()) -> m ()
-- | Receives a serializable value through a BinaryCom
receive :: (Binary a, MonadIO m) => BinaryCom -> m a
-- | Runs a Put monad and sends its result
sendPut :: MonadIO m => BinaryCom -> Put -> m ()
-- | Receives a value. Runs a Get monad to parse it
receiveGet :: MonadIO m => BinaryCom -> Get a -> m a
-- | A if-then-else, but with the condition as last argument
(+|) :: a -> a -> Bool -> a