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

Binrep.Generic.Get

Synopsis

Documentation

getGeneric :: (Generic a, GGetD (Rep a), Get w) => Cfg w -> Getter a Source #

class GGetD f where Source #

Methods

ggetD :: Get w => Cfg w -> Getter (f a) Source #

Instances

Instances details
(GGetC f, Datatype d) => GGetD (D1 d f :: k -> Type) Source # 
Instance details

Defined in Binrep.Generic.Get

Methods

ggetD :: forall w (a :: k0). Get w => Cfg w -> Getter (D1 d f a) Source #

class GGetC f where Source #

Methods

ggetC :: Get w => Cfg w -> String -> Getter (f a) Source #

Instances

Instances details
(TypeError GErrRefuseVoid :: Constraint) => GGetC (V1 :: k -> Type) Source #

Refuse to derive instance for empty data types.

Instance details

Defined in Binrep.Generic.Get

Methods

ggetC :: forall w (a :: k0). Get w => Cfg w -> String -> Getter (V1 a) Source #

GGetCSum (l :+: r) => GGetC (l :+: r :: k -> Type) Source #

Constructor sums are differentiated by a prefix tag.

Instance details

Defined in Binrep.Generic.Get

Methods

ggetC :: forall w (a :: k0). Get w => Cfg w -> String -> Getter ((l :+: r) a) Source #

(GGetS f, Constructor c) => GGetC (C1 c f :: k -> Type) Source #

TODO: Non-sum data types.

Instance details

Defined in Binrep.Generic.Get

Methods

ggetC :: forall w (a :: k0). Get w => Cfg w -> String -> Getter (C1 c f a) Source #

class GGetS f where Source #

Methods

ggetS :: Get w => Cfg w -> String -> String -> Natural -> Getter (Natural, f a) Source #

Instances

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

The empty constructor trivially succeeds without parsing anything.

Instance details

Defined in Binrep.Generic.Get

Methods

ggetS :: forall w (a :: k0). Get w => Cfg w -> String -> String -> Natural -> Getter (Natural, U1 a) Source #

(GGetS l, GGetS r) => GGetS (l :*: r :: k -> Type) Source # 
Instance details

Defined in Binrep.Generic.Get

Methods

ggetS :: forall w (a :: k0). Get w => Cfg w -> String -> String -> Natural -> Getter (Natural, (l :*: r) a) Source #

(Get a, Selector s) => GGetS (S1 s (Rec0 a) :: k -> Type) Source # 
Instance details

Defined in Binrep.Generic.Get

Methods

ggetS :: forall w (a0 :: k0). Get w => Cfg w -> String -> String -> Natural -> Getter (Natural, S1 s (Rec0 a) a0) Source #

class GGetCSum f where Source #

TODO: Want to return an Either [(String, Text)] indicating the constructors and their expected tags tested, but needs fiddling (can't use Alternative). Pretty minor, but Aeson does it and it's nice.

Methods

ggetCSum :: Get w => Cfg w -> String -> w -> Maybe (Getter (f a)) Source #

Instances

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

Defined in Binrep.Generic.Get

Methods

ggetCSum :: forall w (a :: k0). Get w => Cfg w -> String -> w -> Maybe (Getter ((l :+: r) a)) Source #

(GGetS f, Constructor c) => GGetCSum (C1 c f :: k -> Type) Source # 
Instance details

Defined in Binrep.Generic.Get

Methods

ggetCSum :: forall w (a :: k0). Get w => Cfg w -> String -> w -> Maybe (Getter (C1 c f a)) Source #