Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
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.
- data BinaryCom
- binaryCom :: MonadIO m => Handle -> m BinaryCom
- binaryCom2H :: MonadIO m => Handle -> Handle -> m BinaryCom
- binaryComBS :: MonadIO m => ByteString -> Handle -> m BinaryCom
- send :: (Binary a, MonadIO m) => BinaryCom -> a -> m ()
- flushAfter :: MonadIO m => BinaryCom -> (BinaryCom -> m ()) -> m ()
- receive :: (Binary a, MonadIO m) => BinaryCom -> m a
- sendPut :: MonadIO m => BinaryCom -> Put -> m ()
- receiveGet :: MonadIO m => BinaryCom -> Get a -> m a
- (+|) :: a -> a -> Bool -> a
Documentation
:: MonadIO m | |
=> ByteString | For reading |
-> Handle | For writing |
-> m BinaryCom | New |
Creates a BinaryCom
from a lazy ByteString
(for reading) and a Handle
(for writing)
send :: (Binary a, MonadIO m) => BinaryCom -> a -> m () Source
Sends a serializable value through a BinaryCom
flushAfter :: MonadIO m => BinaryCom -> (BinaryCom -> m ()) -> m () Source
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
.
receive :: (Binary a, MonadIO m) => BinaryCom -> m a Source
Receives a serializable value through a BinaryCom