Safe Haskell | None |
---|---|
Language | Haskell2010 |
Strict Decoder
Synopsis
- strictDecoder :: Get a -> ByteString -> Either DecodeException a
- listTDecoder :: Get a -> ByteString -> IO ( ListT IO a)
- type Decoded a = Either DecodeException a
-
data
DecodeException
- = NotEnoughSpace Env
- | TooMuchSpace Env
- | BadEncoding Env String
- data Get a
- dByteString :: Get ByteString
- dLazyByteString :: Get ByteString
- dShortByteString :: Get ShortByteString
- dShortByteString_ :: Get ShortByteString
- dUTF16 :: Get Text
- dUTF8 :: Get Text
- decodeArrayWith :: Get a -> Get [a]
- decodeListWith :: Get a -> Get [a]
- dFloat :: Get Float
- dDouble :: Get Double
- dInteger :: Get Integer
- dNatural :: Get Natural
- dChar :: Get Char
- dBool :: Get Bool
- dWord8 :: Get Word8
- dWord16 :: Get Word16
- dWord32 :: Get Word32
- dWord64 :: Get Word64
- dWord :: Get Word
- dInt8 :: Get Int8
- dInt16 :: Get Int16
- dInt32 :: Get Int32
- dInt64 :: Get Int64
- dInt :: Get Int
- dBE8 :: Get Word8
- dBE16 :: Get Word16
- dBE32 :: Get Word32
- dBE64 :: Get Word64
- dBEBits8 :: Int -> Get Word8
- dBEBits16 :: Int -> Get Word16
- dBEBits32 :: Int -> Get Word32
- dBEBits64 :: Int -> Get Word64
- dropBits :: Int -> Get ()
- data ConsState = ConsState ! Word ! Int
- consOpen :: Get ConsState
- consClose :: Int -> Get ()
- consBool :: ConsState -> ( ConsState , Bool )
- consBits :: ConsState -> Int -> ( ConsState , Word )
Documentation
strictDecoder :: Get a -> ByteString -> Either DecodeException a Source #
Given a decoder and an input buffer returns either the decoded value or an error (if the input buffer is not fully consumed)
listTDecoder :: Get a -> ByteString -> IO ( ListT IO a) Source #
type Decoded a = Either DecodeException a Source #
A decoded value
data DecodeException Source #
An exception during decoding
NotEnoughSpace Env | |
TooMuchSpace Env | |
BadEncoding Env String |
Instances
Eq DecodeException Source # | |
Defined in Flat.Decoder.Types (==) :: DecodeException -> DecodeException -> Bool Source # (/=) :: DecodeException -> DecodeException -> Bool Source # |
|
Ord DecodeException Source # | |
Defined in Flat.Decoder.Types compare :: DecodeException -> DecodeException -> Ordering Source # (<) :: DecodeException -> DecodeException -> Bool Source # (<=) :: DecodeException -> DecodeException -> Bool Source # (>) :: DecodeException -> DecodeException -> Bool Source # (>=) :: DecodeException -> DecodeException -> Bool Source # max :: DecodeException -> DecodeException -> DecodeException Source # min :: DecodeException -> DecodeException -> DecodeException Source # |
|
Show DecodeException Source # | |
Defined in Flat.Decoder.Types |
|
Exception DecodeException Source # | |
Defined in Flat.Decoder.Types |
A decoder.
Given: * end of input buffer * current position in input buffer
returns: * decoded value * new position in input buffer
decodeArrayWith :: Get a -> Get [a] Source #
decodeListWith :: Get a -> Get [a] Source #
dBEBits8 :: Int -> Get Word8 Source #
Return the n most significant bits (up to maximum of 8)
The bits are returned right shifted: >>> unflatWith (dBEBits8 3) [0b11100001::Word8] == Right 0b00000111 True
dBEBits16 :: Int -> Get Word16 Source #
Return the n most significant bits (up to maximum of 16) The bits are returned right shifted.
dBEBits32 :: Int -> Get Word32 Source #
Return the n most significant bits (up to maximum of 32) The bits are returned right shifted.
dBEBits64 :: Int -> Get Word64 Source #
Return the n most significant bits (up to maximum of 64) The bits are returned right shifted.
A special state, optimised for constructor decoding.
It consists of:
- The bits to parse, the top bit being the first to parse (could use a Word16 instead, no difference in performance)
- The number of decoded bits
Supports up to 512 constructors (9 bits).