binrep-0.3.1: Encode precise binary representations directly in types
Safe HaskellSafe-Inferred
LanguageHaskell2010

Binrep.Generic.Put

Synopsis

Documentation

putGeneric :: (Generic a, GPut (Rep a), Put w) => Cfg w -> a -> Builder Source #

class GPut f where Source #

Methods

gput :: Put w => Cfg w -> f p -> Builder Source #

Instances

Instances details
GPut (U1 :: k -> Type) Source #

Empty constructor.

Instance details

Defined in Binrep.Generic.Put

Methods

gput :: forall w (p :: k0). Put w => Cfg w -> U1 p -> Builder Source #

(TypeError GErrRefuseVoid :: Constraint) => GPut (V1 :: k -> Type) Source #

Refuse to derive instance for void datatype.

Instance details

Defined in Binrep.Generic.Put

Methods

gput :: forall w (p :: k0). Put w => Cfg w -> V1 p -> Builder Source #

(GPut l, GPut r) => GPut (l :*: r :: k -> Type) Source #

Product type fields are consecutive.

Instance details

Defined in Binrep.Generic.Put

Methods

gput :: forall w (p :: k0). Put w => Cfg w -> (l :*: r) p -> Builder Source #

(GPutSum (l :+: r), GetConName (l :+: r)) => GPut (l :+: r :: k -> Type) Source #

Constructor sums are differentiated by a prefix tag.

Instance details

Defined in Binrep.Generic.Put

Methods

gput :: forall w (p :: k0). Put w => Cfg w -> (l :+: r) p -> Builder Source #

Put c => GPut (K1 i c :: k -> Type) Source #

Field.

Instance details

Defined in Binrep.Generic.Put

Methods

gput :: forall w (p :: k0). Put w => Cfg w -> K1 i c p -> Builder Source #

GPut f => GPut (M1 i d f :: k -> Type) Source #

Any datatype, constructor or record.

Instance details

Defined in Binrep.Generic.Put

Methods

gput :: forall w (p :: k0). Put w => Cfg w -> M1 i d f p -> Builder Source #

class GPutSum f where Source #

Methods

gputsum :: Put w => Cfg w -> f a -> Builder Source #

Instances

Instances details
(GPutSum l, GPutSum r) => GPutSum (l :+: r :: k -> Type) Source # 
Instance details

Defined in Binrep.Generic.Put

Methods

gputsum :: forall w (a :: k0). Put w => Cfg w -> (l :+: r) a -> Builder Source #

(GPut r, Constructor c) => GPutSum (C1 c r :: k -> Type) Source # 
Instance details

Defined in Binrep.Generic.Put

Methods

gputsum :: forall w (a :: k0). Put w => Cfg w -> C1 c r a -> Builder Source #

class GetConName f where Source #

Get the name of the constructor of a sum datatype.

Methods

getConName :: f a -> String Source #

Instances

Instances details
(GetConName a, GetConName b) => GetConName (a :+: b :: k -> Type) Source # 
Instance details

Defined in Binrep.Generic.Put

Methods

getConName :: forall (a0 :: k0). (a :+: b) a0 -> String Source #

Constructor c => GetConName (C1 c a :: k -> Type) Source # 
Instance details

Defined in Binrep.Generic.Put

Methods

getConName :: forall (a0 :: k0). C1 c a a0 -> String Source #