Safe Haskell | None |
---|---|
Language | Haskell2010 |
Strict Decoder
Synopsis
- strictDecoder :: Get a -> ByteString -> Either DecodeException 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 #
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 # (/=) :: DecodeException -> DecodeException -> Bool # | |
Ord DecodeException Source # | |
Defined in Flat.Decoder.Types compare :: DecodeException -> DecodeException -> Ordering # (<) :: DecodeException -> DecodeException -> Bool # (<=) :: DecodeException -> DecodeException -> Bool # (>) :: DecodeException -> DecodeException -> Bool # (>=) :: DecodeException -> DecodeException -> Bool # max :: DecodeException -> DecodeException -> DecodeException # min :: DecodeException -> DecodeException -> DecodeException # | |
Show DecodeException Source # | |
Defined in Flat.Decoder.Types showsPrec :: Int -> DecodeException -> ShowS # show :: DecodeException -> String # showList :: [DecodeException] -> ShowS # | |
Exception DecodeException Source # | |
Defined in Flat.Decoder.Types |
Decoder monad
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 8) The bits are returned right shifted.
dBEBits64 :: Int -> Get Word64 Source #
Return the n most significant bits (up to maximum of 8) 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).