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

Safe HaskellTrustworthy
LanguageHaskell2010

Data.Flat.Class

Contents

Description

Generics-based generation of Flat instances

Synopsis

The Flat class

class Flat a where #

Class of types that can be encoded/decoded

Methods

encode :: a -> Encoding #

encode :: (Generic a, GEncode (Rep a)) => a -> Encoding #

decode :: Get a #

decode :: (Generic a, GDecode (Rep a)) => Get a #

size :: a -> NumBits -> NumBits #

size :: (Generic a, GSize (Rep a)) => a -> NumBits -> NumBits #

Instances

Flat Filler #

Use a special encoding for the filler

Flat a => Flat (PreAligned a) # 
Flat a => Flat (PostAligned a) # 

getSize :: Flat a => a -> NumBits #

Calculate the size in bits of the serialisation of the value