describe-0.2.0.4: Combinators for describing binary data structures

Safe HaskellNone
LanguageHaskell2010

Data.Serialize.Describe.Combinators

Description

Various type-level combinators to ease generic derivation of Describe

Synopsis

Documentation

newtype Optional p t Source #

An Optional represents a field which is optionally-serializable. The field will be parsed via a lookAhead and, if the value matches the Predicate p, then the field exists. If not, it is assumed as though the field was never serialized in the first place and the value will be set to Nothing; parsing will then continue on as usual.

Constructors

Optional 

Fields

Instances
(Describe a, Predicate a p) => Describe (Optional p a) Source # 
Instance details

Defined in Data.Serialize.Describe.Combinators

Methods

describe :: (s -> Optional p a) -> Descriptor s (Optional p a) Source #

class Predicate t a where Source #

Methods

check :: t -> Bool Source #

Instances
(KnownNat n, Integral i) => Predicate i (Equals n) Source # 
Instance details

Defined in Data.Serialize.Describe.Combinators

Methods

check :: i -> Bool Source #

(KnownNat n1, KnownNat n2, Arity n2, Vector (Vec n2) i, Integral i) => Predicate (Vec n2 i) (Equals n1) Source # 
Instance details

Defined in Data.Serialize.Describe.Combinators

Methods

check :: Vec n2 i -> Bool Source #

data Equals (n :: Nat) Source #

Instances
(KnownNat n, Integral i) => Predicate i (Equals n) Source # 
Instance details

Defined in Data.Serialize.Describe.Combinators

Methods

check :: i -> Bool Source #

(KnownNat n1, KnownNat n2, Arity n2, Vector (Vec n2) i, Integral i) => Predicate (Vec n2 i) (Equals n1) Source # 
Instance details

Defined in Data.Serialize.Describe.Combinators

Methods

check :: Vec n2 i -> Bool Source #