Copyright | (c) 2020 Composewell Technologies |
---|---|
License | BSD-3-Clause |
Maintainer | streamly@composewell.com |
Stability | pre-release |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Decode Haskell data types from byte streams.
Synopsis
- class FromBytes a where
- unit :: Monad m => Parser Word8 m ()
- bool :: Monad m => Parser Word8 m Bool
- ordering :: Monad m => Parser Word8 m Ordering
- eqWord8 :: Monad m => Word8 -> Parser Word8 m Word8
- word8 :: Monad m => Parser Word8 m Word8
- word16be :: Monad m => Parser Word8 m Word16
- word16le :: Monad m => Parser Word8 m Word16
- word32be :: Monad m => Parser Word8 m Word32
- word32le :: Monad m => Parser Word8 m Word32
- word64be :: Monad m => Parser Word8 m Word64
- word64le :: Monad m => Parser Word8 m Word64
- word64host :: MonadIO m => Parser Word8 m Word64
- int8 :: Monad m => Parser Word8 m Int8
- int16be :: Monad m => Parser Word8 m Int16
- int16le :: Monad m => Parser Word8 m Int16
- int32be :: Monad m => Parser Word8 m Int32
- int32le :: Monad m => Parser Word8 m Int32
- int64be :: Monad m => Parser Word8 m Int64
- int64le :: Monad m => Parser Word8 m Int64
- float32be :: MonadIO m => Parser Word8 m Float
- float32le :: MonadIO m => Parser Word8 m Float
- double64be :: MonadIO m => Parser Word8 m Double
- double64le :: MonadIO m => Parser Word8 m Double
- charLatin1 :: Monad m => Parser Word8 m Char
Type class
Decoders
unit :: Monad m => Parser Word8 m () Source #
A value of type ()
is encoded as 0
in binary encoding.
0 ==> ()
Pre-release
ordering :: Monad m => Parser Word8 m Ordering Source #
A value of type Ordering
is encoded as follows in binary encoding.
0 ==> LT 1 ==> EQ 2 ==> GT
Pre-release
eqWord8 :: Monad m => Word8 -> Parser Word8 m Word8 Source #
Accept the input byte only if it is equal to the specified value.
Pre-release
word16be :: Monad m => Parser Word8 m Word16 Source #
Parse two bytes as a Word16
, the first byte is the MSB of the Word16 and
second byte is the LSB (big endian representation).
Pre-release
word16le :: Monad m => Parser Word8 m Word16 Source #
Parse two bytes as a Word16
, the first byte is the LSB of the Word16 and
second byte is the MSB (little endian representation).
Pre-release
word32be :: Monad m => Parser Word8 m Word32 Source #
Parse four bytes as a Word32
, the first byte is the MSB of the Word32
and last byte is the LSB (big endian representation).
Pre-release
word32le :: Monad m => Parser Word8 m Word32 Source #
Parse four bytes as a Word32
, the first byte is the MSB of the Word32
and last byte is the LSB (big endian representation).
Pre-release
word64be :: Monad m => Parser Word8 m Word64 Source #
Parse eight bytes as a Word64
, the first byte is the MSB of the Word64
and last byte is the LSB (big endian representation).
Pre-release
word64le :: Monad m => Parser Word8 m Word64 Source #
Parse eight bytes as a Word64
, the first byte is the MSB of the Word64
and last byte is the LSB (big endian representation).
Pre-release
word64host :: MonadIO m => Parser Word8 m Word64 Source #
Parse eight bytes as a Word64
in the host byte order.
Pre-release
int16be :: Monad m => Parser Word8 m Int16 Source #
Parse two bytes as a Int16
, the first byte is the MSB of the Int16 and
second byte is the LSB (big endian representation).
Pre-release
int16le :: Monad m => Parser Word8 m Int16 Source #
Parse two bytes as a Int16
, the first byte is the LSB of the Int16 and
second byte is the MSB (little endian representation).
Pre-release
int32be :: Monad m => Parser Word8 m Int32 Source #
Parse four bytes as a Int32
, the first byte is the MSB of the Int32
and last byte is the LSB (big endian representation).
Pre-release
int32le :: Monad m => Parser Word8 m Int32 Source #
Parse four bytes as a Int32
, the first byte is the MSB of the Int32
and last byte is the LSB (big endian representation).
Pre-release
int64be :: Monad m => Parser Word8 m Int64 Source #
Parse eight bytes as a Int64
, the first byte is the MSB of the Int64
and last byte is the LSB (big endian representation).
Pre-release