Modulestreamly-core-0.3.1Haskell2010
Streamly.Internal.Data.Binary.Stream
Encode Haskell data types to byte streams.
The primary purpose of this module is to serialize primitive Haskell types to streams for convenient byte by byte processing when such a need arises.
It would be inefficient to use this to build byte streams from algebraic data types. For general serialization of ADTs please use the Serialize type class instances. The fastest way to convert general Haskell types to byte streams is to serialize them to an array and then stream the array.
Contents
Synopsis
- class ToBytes
- value unit
- value bool
- value ordering
- value word8
- value word16be
- value word16le
- value word32be
- value word32le
- value word64be
- value word64le
- value word64host
- value int8
- value int16be
- value int16le
- value int32be
- value int32le
- value int64be
- value int64le
- value float32be
- value float32le
- value double64be
- value double64le
- value charLatin1
- value charUtf8
- Packagestreamly-core-0.3.1
- Exports25
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceStream.hs
Type class
Encoders
A value of type () is encoded as 0 in binary encoding.
0 ==> ()
Pre-release
A value of type Ordering is encoded as follows in binary encoding.
0 ==> LT
1 ==> EQ
2 ==> GT
Pre-release
Stream a Word8.
Pre-release
Stream a Word16 as two bytes, the first byte is the MSB of the Word16 and second byte is the LSB (big endian representation).
Pre-release
Stream a Word16 as two bytes, the first byte is the LSB of the Word16 and second byte is the MSB (little endian representation).
Pre-release
Stream a Word32 as four bytes, the first byte is the MSB of the Word32 and last byte is the LSB (big endian representation).
Pre-release
Stream a Word32 as four bytes, the first byte is the MSB of the Word32 and last byte is the LSB (big endian representation).
Pre-release
Stream a Word64 as eight bytes, the first byte is the MSB of the Word64 and last byte is the LSB (big endian representation).
Pre-release
Stream a Word64 as eight bytes, the first byte is the MSB of the Word64 and last byte is the LSB (big endian representation).
Pre-release
Stream a Word64 as eight bytes in the host byte order.
Pre-release
Stream a Int16 as two bytes, the first byte is the MSB of the Int16 and second byte is the LSB (big endian representation).
Pre-release
Stream a Int16 as two bytes, the first byte is the LSB of the Int16 and second byte is the MSB (little endian representation).
Pre-release
Stream a Int32 as four bytes, the first byte is the MSB of the Int32 and last byte is the LSB (big endian representation).
Pre-release
Stream a Int64 as eight bytes, the first byte is the MSB of the Int64 and last byte is the LSB (big endian representation).
Pre-release
Stream a Int64 as eight bytes, the first byte is the LSB of the Int64 and last byte is the MSB (little endian representation).
Pre-release
Big endian (MSB first) Float
Little endian (LSB first) Float
Big endian (MSB first) Double
Little endian (LSB first) Double
Encode a Unicode character to stream of bytes in 0-255 range.