flat-0.6: Principled and efficient bit-oriented binary serialization.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Flat.Filler

Description

Pre-value and post-value byte alignments

Synopsis

Documentation

data Filler Source #

A meaningless sequence of 0 bits terminated with a 1 bit (easier to implement than the reverse)

Used to align encoded values at byte/word boundaries.

Constructors

FillerBit !Filler 
FillerEnd 

Instances

Instances details
Generic Filler Source # 
Instance details

Defined in Flat.Filler

Associated Types

type Rep Filler :: Type -> Type #

Methods

from :: Filler -> Rep Filler x #

to :: Rep Filler x -> Filler #

Show Filler Source # 
Instance details

Defined in Flat.Filler

NFData Filler Source # 
Instance details

Defined in Flat.Filler

Methods

rnf :: Filler -> () #

Flat Filler Source #

Use a special encoding for the filler

Instance details

Defined in Flat.Filler

Eq Filler Source # 
Instance details

Defined in Flat.Filler

Methods

(==) :: Filler -> Filler -> Bool #

(/=) :: Filler -> Filler -> Bool #

Ord Filler Source # 
Instance details

Defined in Flat.Filler

type Rep Filler Source # 
Instance details

Defined in Flat.Filler

type Rep Filler = D1 ('MetaData "Filler" "Flat.Filler" "flat-0.6-CjdmNH3KA6VH8k7cYdCbFX" 'False) (C1 ('MetaCons "FillerBit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Filler)) :+: C1 ('MetaCons "FillerEnd" 'PrefixI 'False) (U1 :: Type -> Type))

fillerLength :: Num a => Filler -> a Source #

Length of a filler in bits

data PreAligned a Source #

A Pre aligned value, a value preceded by a filler

Useful to prealign ByteArrays, Texts and any structure that can be encoded more efficiently when byte aligned.

Constructors

PreAligned 

Fields

Instances

Instances details
Generic (PreAligned a) Source # 
Instance details

Defined in Flat.Filler

Associated Types

type Rep (PreAligned a) :: Type -> Type #

Methods

from :: PreAligned a -> Rep (PreAligned a) x #

to :: Rep (PreAligned a) x -> PreAligned a #

Show a => Show (PreAligned a) Source # 
Instance details

Defined in Flat.Filler

NFData a => NFData (PreAligned a) Source # 
Instance details

Defined in Flat.Filler

Methods

rnf :: PreAligned a -> () #

Flat a => Flat (PreAligned a) Source # 
Instance details

Defined in Flat.Filler

Eq a => Eq (PreAligned a) Source # 
Instance details

Defined in Flat.Filler

Methods

(==) :: PreAligned a -> PreAligned a -> Bool #

(/=) :: PreAligned a -> PreAligned a -> Bool #

Ord a => Ord (PreAligned a) Source # 
Instance details

Defined in Flat.Filler

type Rep (PreAligned a) Source # 
Instance details

Defined in Flat.Filler

type Rep (PreAligned a) = D1 ('MetaData "PreAligned" "Flat.Filler" "flat-0.6-CjdmNH3KA6VH8k7cYdCbFX" 'False) (C1 ('MetaCons "PreAligned" 'PrefixI 'True) (S1 ('MetaSel ('Just "preFiller") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Filler) :*: S1 ('MetaSel ('Just "preValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

preAligned :: a -> PreAligned a Source #

Pre align a value

data PostAligned a Source #

A Post aligned value, a value followed by a filler

Useful to complete the encoding of a top-level value

Constructors

PostAligned 

Fields

Instances

Instances details
Generic (PostAligned a) Source # 
Instance details

Defined in Flat.Filler

Associated Types

type Rep (PostAligned a) :: Type -> Type #

Methods

from :: PostAligned a -> Rep (PostAligned a) x #

to :: Rep (PostAligned a) x -> PostAligned a #

Show a => Show (PostAligned a) Source # 
Instance details

Defined in Flat.Filler

NFData a => NFData (PostAligned a) Source # 
Instance details

Defined in Flat.Filler

Methods

rnf :: PostAligned a -> () #

Flat a => Flat (PostAligned a) Source # 
Instance details

Defined in Flat.Filler

Eq a => Eq (PostAligned a) Source # 
Instance details

Defined in Flat.Filler

Ord a => Ord (PostAligned a) Source # 
Instance details

Defined in Flat.Filler

type Rep (PostAligned a) Source # 
Instance details

Defined in Flat.Filler

type Rep (PostAligned a) = D1 ('MetaData "PostAligned" "Flat.Filler" "flat-0.6-CjdmNH3KA6VH8k7cYdCbFX" 'False) (C1 ('MetaCons "PostAligned" 'PrefixI 'True) (S1 ('MetaSel ('Just "postValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "postFiller") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Filler)))

postAligned :: a -> PostAligned a Source #

Post align a value

preAlignedDecoder :: Get b -> Get b Source #

Decode a value assuming that is PreAligned

Since: 0.5

postAlignedDecoder :: Get b -> Get b Source #

Decode a value assuming that is PostAligned