Put merely lifts Builder into a Writer monad, applied to ().
Modulebinary-0.8.9.3Haskell2010
Data.Binary.Put
The Put monad. A monad for efficiently constructing lazy bytestrings.
Contents
Synopsis
- type Put
- newtype PutM
- value runPut
- value runPutM
- value putBuilder
- value execPut
- value flush
- value putWord8
- value putInt8
- value putByteString
- value putLazyByteString
- value putShortByteString
- value putWord16be
- value putWord32be
- value putWord64be
- value putInt16be
- value putInt32be
- value putInt64be
- value putFloatbe
- value putDoublebe
- value putWord16le
- value putWord32le
- value putWord64le
- value putInt16le
- value putInt32le
- value putInt64le
- value putFloatle
- value putDoublele
- value putWordhost
- value putWord16host
- value putWord32host
- value putWord64host
- value putInthost
- value putInt16host
- value putInt32host
- value putInt64host
- value putFloathost
- value putDoublehost
- value putCharUtf8
- value putStringUtf8
- Packagebinary-0.8.9.3
- Exports40
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourcePut.hs
The Put type
Instances5Monad, Functor, Applicative, Semigroup, Monoid
Run the Put monad with a serialiser
Run the Put monad with a serialiser and get its result
Run the Put monad
Flushing the implicit parse state
Pop the ByteString we have constructed so far, if any, yielding a new chunk in the result ByteString.
Primitives
Efficiently write a byte into the output buffer
Efficiently write a signed byte into the output buffer
An efficient primitive to write a strict ByteString into the output buffer. It flushes the current buffer, and writes the argument into a new chunk.
Write a lazy ByteString efficiently, simply appending the lazy ByteString chunks to the output buffer
Write ShortByteString to the buffer
Big-endian primitives
Write a Word16 in big endian format
Write a Word32 in big endian format
Write a Word64 in big endian format
Write an Int16 in big endian format
Write an Int32 in big endian format
Write an Int64 in big endian format
Write a Float in big endian IEEE-754 format.
Write a Double in big endian IEEE-754 format.
Little-endian primitives
Write a Word16 in little endian format
Write a Word32 in little endian format
Write a Word64 in little endian format
Write an Int16 in little endian format
Write an Int32 in little endian format
Write an Int64 in little endian format
Write a Float in little endian IEEE-754 format.
Write a Double in little endian IEEE-754 format.
Host-endian, unaligned writes
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.
O(1). Write a Word16 in native host order and host endianness.
For portability issues see putWordhost.
O(1). Write a Word32 in native host order and host endianness.
For portability issues see putWordhost.
O(1). Write a Word64 in native host order
On a 32 bit machine we write two host order Word32s, in big endian form.
For portability issues see putWordhost.
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 Int 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.
O(1). Write an Int16 in native host order and host endianness.
For portability issues see putInthost.
O(1). Write an Int32 in native host order and host endianness.
For portability issues see putInthost.
O(1). Write an Int64 in native host order
On a 32 bit machine we write two host order Int32s, in big endian form.
For portability issues see putInthost.
Write a Float in native in IEEE-754 format and host endian.
Write a Double in native in IEEE-754 format and host endian.
Unicode
Write a character using UTF-8 encoding.
Write a String using UTF-8 encoding.