Copyright | Lennart Kolmodin |
---|---|
License | BSD3-style (see LICENSE) |
Maintainer | Lennart Kolmodin <[email protected]> |
Stability | stable |
Portability | Portable to Hugs and GHC. Requires MPTCs |
Safe Haskell | Safe |
Language | Haskell98 |
The Put monad. A monad for efficiently constructing lazy bytestrings.
Put merely lifts Builder into a Writer monad, applied to ().
The PutM type. A Writer monad over the efficient Builder monoid.
runPut :: Put -> ByteString Source
Run the Put
monad with a serialiser
runPutM :: PutM a -> (a, ByteString) Source
Run the Put
monad with a serialiser and get its result
putBuilder :: Builder -> Put Source
execPut :: PutM a -> Builder Source
Run the Put
monad
Pop the ByteString we have constructed so far, if any, yielding a new chunk in the result ByteString.
putWord8 :: Word8 -> Put Source
Efficiently write a byte into the output buffer
Efficiently write a signed byte into the output buffer
putByteString :: ByteString -> Put Source
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.
putLazyByteString :: ByteString -> Put Source
Write a lazy ByteString efficiently, simply appending the lazy ByteString chunks to the output buffer
putShortByteString :: ShortByteString -> Put Source
Write ShortByteString
to the buffer
putWord16be :: Word16 -> Put Source
Write a Word16 in big endian format
putWord32be :: Word32 -> Put Source
Write a Word32 in big endian format
putWord64be :: Word64 -> Put Source
Write a Word64 in big endian format
putInt16be :: Int16 -> Put Source
Write an Int16 in big endian format
putInt32be :: Int32 -> Put Source
Write an Int32 in big endian format
putInt64be :: Int64 -> Put Source
Write an Int64 in big endian format
putFloatbe :: Float -> Put Source
Write a Float
in big endian IEEE-754 format.
putDoublebe :: Double -> Put Source
Write a Double
in big endian IEEE-754 format.
putWord16le :: Word16 -> Put Source
Write a Word16 in little endian format
putWord32le :: Word32 -> Put Source
Write a Word32 in little endian format
putWord64le :: Word64 -> Put Source
Write a Word64 in little endian format
putInt16le :: Int16 -> Put Source
Write an Int16 in little endian format
putInt32le :: Int32 -> Put Source
Write an Int32 in little endian format
putInt64le :: Int64 -> Put Source
Write an Int64 in little endian format
putFloatle :: Float -> Put Source
Write a Float
in little endian IEEE-754 format.
putDoublele :: Double -> Put Source
Write a Double
in little endian IEEE-754 format.
putWordhost :: Word -> Put 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.
putWord16host :: Word16 -> Put Source
O(1). Write a Word16 in native host order and host endianness. For portability issues see putWordhost
.
putWord32host :: Word32 -> Put Source
O(1). Write a Word32 in native host order and host endianness. For portability issues see putWordhost
.
putWord64host :: Word64 -> Put Source
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
.
putInthost :: Int -> Put 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 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.
putInt16host :: Int16 -> Put Source
O(1). Write an Int16 in native host order and host endianness. For portability issues see putInthost
.
putInt32host :: Int32 -> Put Source
O(1). Write an Int32 in native host order and host endianness. For portability issues see putInthost
.
putInt64host :: Int64 -> Put Source
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
.
putFloathost :: Float -> Put Source
Write a Float
in native in IEEE-754 format and host endian.
putDoublehost :: Double -> Put Source
Write a Double
in native in IEEE-754 format and host endian.
putCharUtf8 :: Char -> Put Source
Write a character using UTF-8 encoding.
putStringUtf8 :: String -> Put Source
Write a String using UTF-8 encoding.
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.8.3/docs/html/libraries/binary-0.8.7.0/Data-Binary-Put.html