Copyright | (c) Edward Kmett 2013-2015 |
---|---|
License | BSD3 |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell98 |
Synopsis
- class (Applicative m, Monad m) => MonadPut m where
- runPutL :: Put -> ByteString
- runPutS :: Put -> ByteString
Documentation
class (Applicative m, Monad m) => MonadPut m where Source #
putWord8 :: Word8 -> m () Source #
Efficiently write a byte into the output buffer
putWord8 :: (m ~ t n, MonadTrans t, MonadPut n) => Word8 -> m () Source #
Efficiently write a byte into the output buffer
putByteString :: ByteString -> m () Source #
An efficient primitive to write a strict ByteString
into the output buffer.
In binary
this flushes the current buffer, and writes the argument into a new chunk.
putByteString :: (m ~ t n, MonadTrans t, MonadPut n) => ByteString -> m () Source #
An efficient primitive to write a strict ByteString
into the output buffer.
In binary
this flushes the current buffer, and writes the argument into a new chunk.
putLazyByteString :: ByteString -> m () Source #
Write a lazy ByteString
efficiently.
With binary
, this simply appends the chunks to the output buffer
putLazyByteString :: (m ~ t n, MonadTrans t, MonadPut n) => ByteString -> m () Source #
Write a lazy ByteString
efficiently.
With binary
, this simply appends the chunks to the output buffer
Pop the ByteString
we have constructed so far, if any, yielding a
new chunk in the result ByteString
.
If we're building a strict ByteString
with cereal
then this does nothing.
flush :: (m ~ t n, MonadTrans t, MonadPut n) => m () Source #
Pop the ByteString
we have constructed so far, if any, yielding a
new chunk in the result ByteString
.
If we're building a strict ByteString
with cereal
then this does nothing.
putWord16le :: Word16 -> m () Source #
Write a Word16
in little endian format
putWord16le :: (m ~ t n, MonadTrans t, MonadPut n) => Word16 -> m () Source #
Write a Word16
in little endian format
putWord16be :: Word16 -> m () Source #
Write a Word16
in big endian format
putWord16be :: (m ~ t n, MonadTrans t, MonadPut n) => Word16 -> m () Source #
Write a Word16
in big endian format
putWord16host :: Word16 -> m () Source #
O(1). Write a Word16
in native host order and host endianness.
For portability issues see putWordhost
.
putWord16host :: (m ~ t n, MonadTrans t, MonadPut n) => Word16 -> m () Source #
O(1). Write a Word16
in native host order and host endianness.
For portability issues see putWordhost
.
putWord32le :: Word32 -> m () Source #
Write a Word32
in little endian format
putWord32le :: (m ~ t n, MonadTrans t, MonadPut n) => Word32 -> m () Source #
Write a Word32
in little endian format
putWord32be :: Word32 -> m () Source #
Write a Word32
in big endian format
putWord32be :: (m ~ t n, MonadTrans t, MonadPut n) => Word32 -> m () Source #
Write a Word32
in big endian format
putWord32host :: Word32 -> m () Source #
O(1). Write a Word32
in native host order and host endianness.
For portability issues see putWordhost
.
putWord32host :: (m ~ t n, MonadTrans t, MonadPut n) => Word32 -> m () Source #
O(1). Write a Word32
in native host order and host endianness.
For portability issues see putWordhost
.
putWord64le :: Word64 -> m () Source #
Write a Word64
in little endian format
putWord64le :: (m ~ t n, MonadTrans t, MonadPut n) => Word64 -> m () Source #
Write a Word64
in little endian format
putWord64be :: Word64 -> m () Source #
Write a Word64
in big endian format
putWord64be :: (m ~ t n, MonadTrans t, MonadPut n) => Word64 -> m () Source #
Write a Word64
in big endian format
putWord64host :: Word64 -> m () Source #
O(1). Write a Word64
in native host order and host endianness.
For portability issues see putWordhost
.
putWord64host :: (m ~ t n, MonadTrans t, MonadPut n) => Word64 -> m () Source #
O(1). Write a Word64
in native host order and host endianness.
For portability issues see putWordhost
.
putWordhost :: Word -> m () Source #
O(1). Write a single native machine word. The word is written in host order, host endian form, for the machine you're on. On a 64 bit machine the Word is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this way are not portable to different endian or word sized machines, without conversion.
putWordhost :: (m ~ t n, MonadTrans t, MonadPut n) => Word -> m () Source #
O(1). Write a single native machine word. The word is written in host order, host endian form, for the machine you're on. On a 64 bit machine the Word is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this way are not portable to different endian or word sized machines, without conversion.
Instances
runPutL :: Put -> ByteString Source #
Put a value into a lazy ByteString
using runPut
.
runPutS :: Put -> ByteString Source #
Put a value into a strict ByteString
using runPut
.