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 Source #

Class of types that can be encoded/decoded

Methods

encode :: a -> Encoding Source #

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

decode :: Get a Source #

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

size :: a -> NumBits -> NumBits Source #

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

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

Calculate the size in bits of the serialisation of the value