flat-0.3: Principled and efficient bit-oriented binary serialization.

Safe HaskellNone
LanguageHaskell2010

Data.Flat.Decoder

Description

Strict Decoder

Synopsis

Documentation

type Decoded a = Either DecodeException a Source #

A decoded value

data Get a Source #

Decoder monad

Instances

Monad Get Source # 

Methods

(>>=) :: Get a -> (a -> Get b) -> Get b #

(>>) :: Get a -> Get b -> Get b #

return :: a -> Get a #

fail :: String -> Get a #

Functor Get Source # 

Methods

fmap :: (a -> b) -> Get a -> Get b #

(<$) :: a -> Get b -> Get a #

Applicative Get Source # 

Methods

pure :: a -> Get a #

(<*>) :: Get (a -> b) -> Get a -> Get b #

(*>) :: Get a -> Get b -> Get b #

(<*) :: Get a -> Get b -> Get a #

Show (Get a) Source # 

Methods

showsPrec :: Int -> Get a -> ShowS #

show :: Get a -> String #

showList :: [Get a] -> ShowS #

NFData (Get a) Source # 

Methods

rnf :: Get a -> () #

dFloat :: Get Float Source #

Decode a Float

dDouble :: Get Double Source #

Decode a Double

dBool :: Get Bool Source #

Decode a boolean

dWord8 :: Get Word8 Source #

Return the 8 most significant bits (same as dBE8)

dBE8 :: Get Word8 Source #

Return the 8 most significant bits

dBE16 :: Get Word16 Source #

Return the 16 most significant bits

dBE32 :: Get Word32 Source #

Return the 32 most significant bits

dBE64 :: Get Word64 Source #

Return the 64 most significant bits

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) [128+64+32+1::Word8]
Right 7

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.

dropBits :: Int -> Get () Source #

Drop the specified number of bits