isobmff-builder-0.11.3.0: A (bytestring-) builder for the ISO-14496-12 base media file format

Safe HaskellNone
LanguageHaskell2010

Data.Type.BitRecords.Core

Contents

Synopsis

Bit-Records

Bit-Record Type

data BitRecord where Source #

BitRecordFields assembly

Instances

BitStringBuilderHoley (Proxy BitRecord (Eval BitRecord r)) a => BitStringBuilderHoley (Proxy (IsA * BitRecord) r) a Source # 
BitStringBuilderHoley (Proxy BitRecord EmptyBitRecord) a Source # 
BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt k st len t)) f) a => BitStringBuilderHoley (Proxy BitRecord (BitRecordMember rt k st len t f)) a Source # 

Associated Types

type ToBitStringBuilder (Proxy BitRecord (BitRecordMember rt k st len t f)) a :: * Source #

(BitStringBuilderHoley (Proxy BitRecord l) (ToBitStringBuilder (Proxy BitRecord r) a), BitStringBuilderHoley (Proxy BitRecord r) a) => BitStringBuilderHoley (Proxy BitRecord (BitRecordAppend l r)) a Source # 
type ToPretty BitRecord rec Source # 
type SizeFieldValue BitRecord b Source # 
type ($~) BitRecord BitRecord (BitRecordAppendFun_ l) r Source # 
type Eval BitRecord (OptionalRecord (Nothing BitRecord)) Source # 
type Eval BitRecord (OptionalRecord (Just BitRecord t)) Source # 
type Eval BitRecord (StaticExpandableContent record) Source # 
type Eval BitRecord (RecArray r n) Source # 
type Eval BitRecord ((:^+) l r) Source # 
type Eval BitRecord ((:+^) l r) Source # 
type Eval BitRecord (BitRecordOfList foo f xs) Source # 
type Eval BitRecord (Sized rt len t1 sf r) Source # 
type Eval BitRecord (Sized rt len t1 sf r) = (.+:) rt * Nat len t1 ((:=) rt len Nat t1 ((@:) rt * Nat len t1 "size" sf) (SizeFieldValue BitRecord r)) r
type Eval BitRecord (RecordField rt k st len t f) Source # 
type Eval BitRecord (RecordField rt k st len t f) = BitRecordMember rt k st len t f
type Eval BitRecord (MaybeField rt k st len t (Nothing (IsA Type (BitRecordField rt k st len t)))) Source # 
type Eval BitRecord (MaybeField rt k st len t (Nothing (IsA Type (BitRecordField rt k st len t)))) = EmptyBitRecord
type Eval BitRecord (MaybeField rt k st len t (Just (IsA Type (BitRecordField rt k st len t)) fld)) Source # 
type Eval BitRecord (MaybeField rt k st len t (Just (IsA Type (BitRecordField rt k st len t)) fld)) = BitRecordMember rt k st len t fld
type Eval BitRecord (SizedField rt k st len t2 rt1 len1 t1 sf r) Source # 
type Eval BitRecord (SizedField rt k st len t2 rt1 len1 t1 sf r) = (.+.) rt k st len t2 rt1 * Nat len1 t1 ((:=) rt1 len1 Nat t1 ((@:) rt1 * Nat len1 t1 "size" sf) (SizeFieldValue (IsA Type (BitRecordField rt k st len t2)) r)) r
type ToBitStringBuilder (Proxy (IsA * BitRecord) r) a Source # 
type ToBitStringBuilder (Proxy BitRecord EmptyBitRecord) a Source # 
type ToBitStringBuilder (Proxy BitRecord (BitRecordMember rt k st len t f)) a Source # 
type ToBitStringBuilder (Proxy BitRecord (BitRecordMember rt k st len t f)) a = ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt k st len t)) f) a
type ToBitStringBuilder (Proxy BitRecord (BitRecordAppend l r)) a Source # 
type ($~) (Descriptor tagInd tag) BitRecord (BitRecordOfDescriptor tagInd tag) (MkDescriptor tagInd tag body) Source # 

type family WhenR (b :: Bool) (x :: BitRecord) :: BitRecord where ... Source #

A conditional BitRecord

Equations

WhenR False r = EmptyBitRecord 
WhenR True r = r 

Basic Accessor

type family BitRecordSize (x :: BitRecord) :: Nat where ... Source #

Eval the size in as a number of bits from a BitRecord

getRecordSizeFromProxy :: forall px rec. KnownNat (BitRecordSize rec) => px rec -> Integer Source #

Return the size of the record.

type OptionalRecordOf f x = (Optional (Pure EmptyBitRecord) f $~ x :: IsA BitRecord) Source #

Either use the value from Just or return a EmptyBitRecord value(types(kinds))

Record composition

data l :+^ r :: IsA BitRecord infixl 3 Source #

Combine two BitRecords to form a new BitRecord. If the parameters are not of type BitRecord they will be converted.

Instances

type Eval BitRecord ((:+^) l r) Source # 

data l :^+ r :: IsA BitRecord infixl 3 Source #

Combine two BitRecords to form a new BitRecord. If the parameters are not of type BitRecord they will be converted.

Instances

type Eval BitRecord ((:^+) l r) Source # 

type (:+:) l r = (l `Append` r :: BitRecord) infixl 3 Source #

Combine two BitRecords to form a new BitRecord. If the parameters are not of type BitRecord they will be converted.

type family Append (l :: BitRecord) (r :: BitRecord) :: BitRecord where ... Source #

type (:+.) r f = Append r (BitRecordMember f) infixl 6 Source #

Append a BitRecord and a BitRecordField

type (.+:) f r = Append (BitRecordMember f) r infixr 6 Source #

Append a BitRecordField and a BitRecord

type (.+.) l r = Append (BitRecordMember l) (BitRecordMember r) infixr 6 Source #

Append a BitRecordField and a BitRecordField forming a BitRecord with two members.

type family (field :: IsA (BitRecordField (t :: BitField (rt :: Type) (st :: k) (len :: Nat)))) :~ (value :: IsA (FieldValue (label :: Symbol) st)) :: IsA (BitRecordField t) where ... infixl 7 Source #

Set a field to either a static, compile time, value or a dynamic, runtime value.

Equations

fld :~ (StaticFieldValue l v) = (l @: fld) := v 
fld :~ (RuntimeFieldValue l) = l @: fld 

type family (fld :: IsA (BitRecordField (t :: BitField (rt :: Type) (st :: k) (len :: Nat)))) :~? (value :: Maybe (IsA (FieldValue (label :: Symbol) st))) :: IsA BitRecord where ... infixl 7 Source #

Like :~ but for a Maybe parameter. In case of Just it behaves like :~ in case of Nothing it return an EmptyBitRecord.

Equations

fld :~? (Just v) = RecordField (fld :~ v) 
fld :~? Nothing = Pure EmptyBitRecord 

type family (fld :: IsA (BitRecordField (t :: BitField (rt :: Type) (st :: k) (len :: Nat)))) :+? (value :: Maybe (IsA (FieldValue (label :: Symbol) st))) :: BitRecord where ... infixl 7 Source #

Like :~ but for a Maybe parameter. In case of Just it behaves like :~ in case of Nothing it return an EmptyBitRecord.

Equations

fld :+? (Just v) = BitRecordMember (fld :~ v) 
fld :+? Nothing = EmptyBitRecord 

data FieldValue :: Symbol -> staticRep -> Type Source #

The field value parameter for :~, either a static, compile time, value or a dynamic, runtime value.

data StaticFieldValue label :: staticRep -> IsA (FieldValue label staticRep) Source #

data RuntimeFieldValue label :: IsA (FieldValue label staticRep) Source #

Record Arrays and Repitition

data RecArray :: BitRecord -> Nat -> IsA BitRecord Source #

An array of records with a fixed number of elements, NOTE: this type is actually not really necessary since ReplicateRecord exists, but this allows to have a different showRecord output.

Instances

type (^^) r n = RecArray r n infixl 5 Source #

type family RecArrayToBitRecord (r :: BitRecord) (n :: Nat) :: BitRecord where ... Source #

Repeat a bit record n times.

Lists of Records

data BitRecordOfList f xs :: IsA BitRecord Source #

Let type level lists also be records

Maybe Record

Field ADT

data BitRecordField :: BitField rt st len -> Type Source #

A family of bit fields.

A bit field always has a size, i.e. the number of bits it uses, as well as a term level value type and a type level value type. It also has an optional label, and an optional value assigned to it.

Instances

BitStringBuilderHoley (Proxy (A Type (BitRecordField Bool * Bool 1 MkFieldFlag) -> Type) (MkField Bool * Bool 1 MkFieldFlag)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int8 * SignedNat 8 MkFieldI8) -> Type) (MkField Int8 * SignedNat 8 MkFieldI8)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int16 * SignedNat 16 MkFieldI16) -> Type) (MkField Int16 * SignedNat 16 MkFieldI16)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int32 * SignedNat 32 MkFieldI32) -> Type) (MkField Int32 * SignedNat 32 MkFieldI32)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int64 * SignedNat 64 MkFieldI64) -> Type) (MkField Int64 * SignedNat 64 MkFieldI64)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Word8 * Nat 8 MkFieldU8) -> Type) (MkField Word8 * Nat 8 MkFieldU8)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Word16 * Nat 16 MkFieldU16) -> Type) (MkField Word16 * Nat 16 MkFieldU16)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Word32 * Nat 32 MkFieldU32) -> Type) (MkField Word32 * Nat 32 MkFieldU32)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Word64 * Nat 64 MkFieldU64) -> Type) (MkField Word64 * Nat 64 MkFieldU64)) a Source # 
(KnownNat v, BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a, (~) * (ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a) (x -> a), Num x) => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a :: * Source #

(KnownNat v, BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a, (~) * (ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a) (x -> a), Num x) => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a :: * Source #

(KnownNat v, BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt * Nat len t)) f) a, (~) * (ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt * Nat len t)) f) a) (rt -> a), Num rt) => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((:=) rt len Nat t f v)) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((:=) rt len Nat t f v)) a :: * Source #

Methods

bitStringBuilderHoley :: Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((rt := len) Nat t f v) -> Holey BitStringBuilder a (ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((rt := len) Nat t f v)) a) Source #

(~) Nat (BitRecordFieldSize rt * Bool size t f) 1 => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f False)) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f False)) a :: * Source #

Methods

bitStringBuilderHoley :: Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((rt := size) Bool t f False) -> Holey BitStringBuilder a (ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((rt := size) Bool t f False)) a) Source #

(~) Nat (BitRecordFieldSize rt * Bool size t f) 1 => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f True)) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f True)) a :: * Source #

Methods

bitStringBuilderHoley :: Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((rt := size) Bool t f True) -> Holey BitStringBuilder a (ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((rt := size) Bool t f True)) a) Source #

BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt k st len t)) nested) a => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested)) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested)) a :: * Source #

Methods

bitStringBuilderHoley :: Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested) -> Holey BitStringBuilder a (ToBitStringBuilder (Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested)) a) Source #

KnownChunkSize s => BitStringBuilderHoley (Proxy (A Type (BitRecordField (B s) * Nat s (MkFieldBits s)) -> Type) (MkField (B s) * Nat s (MkFieldBits s))) a Source # 
KnownChunkSize size => BitStringBuilderHoley (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) (MkField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size))) r Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) (MkField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size))) r :: * Source #

(KnownNat (FromEnum e v), KnownChunkSize size) => BitStringBuilderHoley (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((:=) (EnumValue e) size e (MkFieldCustom * (EnumValue e) e size) f v)) r Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((:=) (EnumValue e) size e (MkFieldCustom * (EnumValue e) e size) f v)) r :: * Source #

Methods

bitStringBuilderHoley :: Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((EnumValue e := size) e (MkFieldCustom * (EnumValue e) e size) f v) -> Holey BitStringBuilder r (ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((EnumValue e := size) e (MkFieldCustom * (EnumValue e) e size) f v)) r) Source #

type Eval BitRecord (MaybeField rt k st len t (Nothing (IsA Type (BitRecordField rt k st len t)))) Source # 
type Eval BitRecord (MaybeField rt k st len t (Nothing (IsA Type (BitRecordField rt k st len t)))) = EmptyBitRecord
type Eval BitRecord (MaybeField rt k st len t (Just (IsA Type (BitRecordField rt k st len t)) fld)) Source # 
type Eval BitRecord (MaybeField rt k st len t (Just (IsA Type (BitRecordField rt k st len t)) fld)) = BitRecordMember rt k st len t fld
type ToPretty (IsA Type (BitRecordField rt Type st size t)) f Source # 
type ToPretty (IsA Type (BitRecordField rt Type st size t)) f = PrettyField rt st size t f
type ToBitStringBuilder (Proxy (A Type (BitRecordField Bool * Bool 1 MkFieldFlag) -> Type) (MkField Bool * Bool 1 MkFieldFlag)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int8 * SignedNat 8 MkFieldI8) -> Type) (MkField Int8 * SignedNat 8 MkFieldI8)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int16 * SignedNat 16 MkFieldI16) -> Type) (MkField Int16 * SignedNat 16 MkFieldI16)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int32 * SignedNat 32 MkFieldI32) -> Type) (MkField Int32 * SignedNat 32 MkFieldI32)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int64 * SignedNat 64 MkFieldI64) -> Type) (MkField Int64 * SignedNat 64 MkFieldI64)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Word8 * Nat 8 MkFieldU8) -> Type) (MkField Word8 * Nat 8 MkFieldU8)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Word16 * Nat 16 MkFieldU16) -> Type) (MkField Word16 * Nat 16 MkFieldU16)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Word32 * Nat 32 MkFieldU32) -> Type) (MkField Word32 * Nat 32 MkFieldU32)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Word64 * Nat 64 MkFieldU64) -> Type) (MkField Word64 * Nat 64 MkFieldU64)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((:=) rt len Nat t f v)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((:=) rt len Nat t f v)) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f False)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f False)) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f True)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f True)) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested)) a = ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt k st len t)) nested) a
type ToBitStringBuilder (Proxy (A Type (BitRecordField (B s) * Nat s (MkFieldBits s)) -> Type) (MkField (B s) * Nat s (MkFieldBits s))) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField (B s) * Nat s (MkFieldBits s)) -> Type) (MkField (B s) * Nat s (MkFieldBits s))) a = B s -> a
type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) (MkField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size))) r Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) (MkField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size))) r = EnumValue e -> r
type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((:=) (EnumValue e) size e (MkFieldCustom * (EnumValue e) e size) f v)) r Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((:=) (EnumValue e) size e (MkFieldCustom * (EnumValue e) e size) f v)) r = r
type SizeFieldValue (A Type (BitRecordField rt k st size t) -> Type) (MkField rt k st size t) Source # 
type SizeFieldValue (A Type (BitRecordField rt k st size t) -> Type) (MkField rt k st size t) = size
type SizeFieldValue (A Type (BitRecordField rt * k size t) -> Type) ((:=) rt size k t f v) Source # 
type SizeFieldValue (A Type (BitRecordField rt * k size t) -> Type) ((:=) rt size k t f v) = SizeFieldValue k v
type SizeFieldValue (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l f) Source # 
type SizeFieldValue (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l f) = SizeFieldValue (IsA Type (BitRecordField rt k st len t)) f

data MkField t :: IsA (BitRecordField t) Source #

A bit record field with a number of bits

Instances

BitStringBuilderHoley (Proxy (A Type (BitRecordField Bool * Bool 1 MkFieldFlag) -> Type) (MkField Bool * Bool 1 MkFieldFlag)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int8 * SignedNat 8 MkFieldI8) -> Type) (MkField Int8 * SignedNat 8 MkFieldI8)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int16 * SignedNat 16 MkFieldI16) -> Type) (MkField Int16 * SignedNat 16 MkFieldI16)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int32 * SignedNat 32 MkFieldI32) -> Type) (MkField Int32 * SignedNat 32 MkFieldI32)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int64 * SignedNat 64 MkFieldI64) -> Type) (MkField Int64 * SignedNat 64 MkFieldI64)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Word8 * Nat 8 MkFieldU8) -> Type) (MkField Word8 * Nat 8 MkFieldU8)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Word16 * Nat 16 MkFieldU16) -> Type) (MkField Word16 * Nat 16 MkFieldU16)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Word32 * Nat 32 MkFieldU32) -> Type) (MkField Word32 * Nat 32 MkFieldU32)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Word64 * Nat 64 MkFieldU64) -> Type) (MkField Word64 * Nat 64 MkFieldU64)) a Source # 
KnownChunkSize s => BitStringBuilderHoley (Proxy (A Type (BitRecordField (B s) * Nat s (MkFieldBits s)) -> Type) (MkField (B s) * Nat s (MkFieldBits s))) a Source # 
KnownChunkSize size => BitStringBuilderHoley (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) (MkField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size))) r Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) (MkField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size))) r :: * Source #

type ToBitStringBuilder (Proxy (A Type (BitRecordField Bool * Bool 1 MkFieldFlag) -> Type) (MkField Bool * Bool 1 MkFieldFlag)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int8 * SignedNat 8 MkFieldI8) -> Type) (MkField Int8 * SignedNat 8 MkFieldI8)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int16 * SignedNat 16 MkFieldI16) -> Type) (MkField Int16 * SignedNat 16 MkFieldI16)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int32 * SignedNat 32 MkFieldI32) -> Type) (MkField Int32 * SignedNat 32 MkFieldI32)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int64 * SignedNat 64 MkFieldI64) -> Type) (MkField Int64 * SignedNat 64 MkFieldI64)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Word8 * Nat 8 MkFieldU8) -> Type) (MkField Word8 * Nat 8 MkFieldU8)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Word16 * Nat 16 MkFieldU16) -> Type) (MkField Word16 * Nat 16 MkFieldU16)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Word32 * Nat 32 MkFieldU32) -> Type) (MkField Word32 * Nat 32 MkFieldU32)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Word64 * Nat 64 MkFieldU64) -> Type) (MkField Word64 * Nat 64 MkFieldU64)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField (B s) * Nat s (MkFieldBits s)) -> Type) (MkField (B s) * Nat s (MkFieldBits s))) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField (B s) * Nat s (MkFieldBits s)) -> Type) (MkField (B s) * Nat s (MkFieldBits s))) a = B s -> a
type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) (MkField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size))) r Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) (MkField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size))) r = EnumValue e -> r
type SizeFieldValue (A Type (BitRecordField rt k st size t) -> Type) (MkField rt k st size t) Source # 
type SizeFieldValue (A Type (BitRecordField rt k st size t) -> Type) (MkField rt k st size t) = size

Setting a Label

data LabelF :: Symbol -> IsA (BitRecordField t) -> IsA (BitRecordField t) Source #

A bit record field with a number of bits

Instances

BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt k st len t)) nested) a => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested)) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested)) a :: * Source #

Methods

bitStringBuilderHoley :: Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested) -> Holey BitStringBuilder a (ToBitStringBuilder (Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested)) a) Source #

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l nested)) a = ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt k st len t)) nested) a
type SizeFieldValue (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l f) Source # 
type SizeFieldValue (A Type (BitRecordField rt k st len t) -> Type) (LabelF rt k st len t l f) = SizeFieldValue (IsA Type (BitRecordField rt k st len t)) f

type (@:) l f = (LabelF l f :: IsA (BitRecordField t)) infixr 8 Source #

A field with a label assigned to it.

Assignment

data (:=) :: forall st t. IsA (BitRecordField t) -> st -> IsA (BitRecordField t) infixl 7 Source #

A field with a value set at compile time.

Instances

(KnownNat v, BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a, (~) * (ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a) (x -> a), Num x) => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a :: * Source #

(KnownNat v, BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a, (~) * (ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a) (x -> a), Num x) => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a :: * Source #

(KnownNat v, BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt * Nat len t)) f) a, (~) * (ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt * Nat len t)) f) a) (rt -> a), Num rt) => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((:=) rt len Nat t f v)) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((:=) rt len Nat t f v)) a :: * Source #

Methods

bitStringBuilderHoley :: Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((rt := len) Nat t f v) -> Holey BitStringBuilder a (ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((rt := len) Nat t f v)) a) Source #

(~) Nat (BitRecordFieldSize rt * Bool size t f) 1 => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f False)) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f False)) a :: * Source #

Methods

bitStringBuilderHoley :: Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((rt := size) Bool t f False) -> Holey BitStringBuilder a (ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((rt := size) Bool t f False)) a) Source #

(~) Nat (BitRecordFieldSize rt * Bool size t f) 1 => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f True)) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f True)) a :: * Source #

Methods

bitStringBuilderHoley :: Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((rt := size) Bool t f True) -> Holey BitStringBuilder a (ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((rt := size) Bool t f True)) a) Source #

(KnownNat (FromEnum e v), KnownChunkSize size) => BitStringBuilderHoley (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((:=) (EnumValue e) size e (MkFieldCustom * (EnumValue e) e size) f v)) r Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((:=) (EnumValue e) size e (MkFieldCustom * (EnumValue e) e size) f v)) r :: * Source #

Methods

bitStringBuilderHoley :: Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((EnumValue e := size) e (MkFieldCustom * (EnumValue e) e size) f v) -> Holey BitStringBuilder r (ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((EnumValue e := size) e (MkFieldCustom * (EnumValue e) e size) f v)) r) Source #

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((:=) rt len Nat t f v)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Nat len t) -> Type) ((:=) rt len Nat t f v)) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f False)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f False)) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f True)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * Bool size t) -> Type) ((:=) rt size Bool t f True)) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((:=) (EnumValue e) size e (MkFieldCustom * (EnumValue e) e size) f v)) r Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField (EnumValue e) * e size (MkFieldCustom * (EnumValue e) e size)) -> Type) ((:=) (EnumValue e) size e (MkFieldCustom * (EnumValue e) e size) f v)) r = r
type SizeFieldValue (A Type (BitRecordField rt * k size t) -> Type) ((:=) rt size k t f v) Source # 
type SizeFieldValue (A Type (BitRecordField rt * k size t) -> Type) ((:=) rt size k t f v) = SizeFieldValue k v

data BitField runtimeRep staticRep bitCount where Source #

Types of this kind define the basic type of a BitRecordField. Sure, this could have been an open type, but really, how many actual useful field types exist? Well, from a global perspective, uncountable infinite, but the focus of this library is to blast out bits over the network, using usual Haskell libraries, and hence, there is actually only very little reason to differentiate types of record fields, other than what low-level library function to apply and how to pretty print the field.

newtype B size Source #

A data type for Field and MkFieldBits, that is internally a Word64. It carries the number of relevant bits in its type.

Constructors

B 

Fields

Instances

Bounded (B size) Source # 

Methods

minBound :: B size #

maxBound :: B size #

Enum (B size) Source # 

Methods

succ :: B size -> B size #

pred :: B size -> B size #

toEnum :: Int -> B size #

fromEnum :: B size -> Int #

enumFrom :: B size -> [B size] #

enumFromThen :: B size -> B size -> [B size] #

enumFromTo :: B size -> B size -> [B size] #

enumFromThenTo :: B size -> B size -> B size -> [B size] #

Eq (B size) Source # 

Methods

(==) :: B size -> B size -> Bool #

(/=) :: B size -> B size -> Bool #

Integral (B size) Source # 

Methods

quot :: B size -> B size -> B size #

rem :: B size -> B size -> B size #

div :: B size -> B size -> B size #

mod :: B size -> B size -> B size #

quotRem :: B size -> B size -> (B size, B size) #

divMod :: B size -> B size -> (B size, B size) #

toInteger :: B size -> Integer #

Num (B size) Source # 

Methods

(+) :: B size -> B size -> B size #

(-) :: B size -> B size -> B size #

(*) :: B size -> B size -> B size #

negate :: B size -> B size #

abs :: B size -> B size #

signum :: B size -> B size #

fromInteger :: Integer -> B size #

Ord (B size) Source # 

Methods

compare :: B size -> B size -> Ordering #

(<) :: B size -> B size -> Bool #

(<=) :: B size -> B size -> Bool #

(>) :: B size -> B size -> Bool #

(>=) :: B size -> B size -> Bool #

max :: B size -> B size -> B size #

min :: B size -> B size -> B size #

Read (B size) Source # 

Methods

readsPrec :: Int -> ReadS (B size) #

readList :: ReadS [B size] #

readPrec :: ReadPrec (B size) #

readListPrec :: ReadPrec [B size] #

Real (B size) Source # 

Methods

toRational :: B size -> Rational #

Show (B size) Source # 

Methods

showsPrec :: Int -> B size -> ShowS #

show :: B size -> String #

showList :: [B size] -> ShowS #

(PrintfArg Word64, (<=) n 64) => PrintfArg (B n) Source # 
Bits (B size) Source # 

Methods

(.&.) :: B size -> B size -> B size #

(.|.) :: B size -> B size -> B size #

xor :: B size -> B size -> B size #

complement :: B size -> B size #

shift :: B size -> Int -> B size #

rotate :: B size -> Int -> B size #

zeroBits :: B size #

bit :: Int -> B size #

setBit :: B size -> Int -> B size #

clearBit :: B size -> Int -> B size #

complementBit :: B size -> Int -> B size #

testBit :: B size -> Int -> Bool #

bitSizeMaybe :: B size -> Maybe Int #

bitSize :: B size -> Int #

isSigned :: B size -> Bool #

shiftL :: B size -> Int -> B size #

unsafeShiftL :: B size -> Int -> B size #

shiftR :: B size -> Int -> B size #

unsafeShiftR :: B size -> Int -> B size #

rotateL :: B size -> Int -> B size #

rotateR :: B size -> Int -> B size #

popCount :: B size -> Int #

FiniteBits (B size) Source # 

Methods

finiteBitSize :: B size -> Int #

countLeadingZeros :: B size -> Int #

countTrailingZeros :: B size -> Int #

KnownChunkSize s => BitStringBuilderHoley (Proxy (A Type (BitRecordField (B s) * Nat s (MkFieldBits s)) -> Type) (MkField (B s) * Nat s (MkFieldBits s))) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField (B s) * Nat s (MkFieldBits s)) -> Type) (MkField (B s) * Nat s (MkFieldBits s))) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField (B s) * Nat s (MkFieldBits s)) -> Type) (MkField (B s) * Nat s (MkFieldBits s))) a = B s -> a

data SignedNat where Source #

A signed field value.

Constructors

PositiveNat :: Nat -> SignedNat 
NegativeNat :: Nat -> SignedNat 

Instances

BitStringBuilderHoley (Proxy (A Type (BitRecordField Int8 * SignedNat 8 MkFieldI8) -> Type) (MkField Int8 * SignedNat 8 MkFieldI8)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int16 * SignedNat 16 MkFieldI16) -> Type) (MkField Int16 * SignedNat 16 MkFieldI16)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int32 * SignedNat 32 MkFieldI32) -> Type) (MkField Int32 * SignedNat 32 MkFieldI32)) a Source # 
BitStringBuilderHoley (Proxy (A Type (BitRecordField Int64 * SignedNat 64 MkFieldI64) -> Type) (MkField Int64 * SignedNat 64 MkFieldI64)) a Source # 
(KnownNat v, BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a, (~) * (ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a) (x -> a), Num x) => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a :: * Source #

(KnownNat v, BitStringBuilderHoley (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a, (~) * (ToBitStringBuilder (Proxy (IsA Type (BitRecordField rt * SignedNat size t)) f) a) (x -> a), Num x) => BitStringBuilderHoley (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a Source # 

Associated Types

type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a :: * Source #

type ToBitStringBuilder (Proxy (A Type (BitRecordField Int8 * SignedNat 8 MkFieldI8) -> Type) (MkField Int8 * SignedNat 8 MkFieldI8)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int16 * SignedNat 16 MkFieldI16) -> Type) (MkField Int16 * SignedNat 16 MkFieldI16)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int32 * SignedNat 32 MkFieldI32) -> Type) (MkField Int32 * SignedNat 32 MkFieldI32)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField Int64 * SignedNat 64 MkFieldI64) -> Type) (MkField Int64 * SignedNat 64 MkFieldI64)) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (NegativeNat v))) a = a
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a Source # 
type ToBitStringBuilder (Proxy (A Type (BitRecordField rt * SignedNat size t) -> Type) ((:=) rt size SignedNat t f (PositiveNat v))) a = a

Composed Fields

type family FlagJust (a :: Maybe (v :: Type)) :: IsA (BitRecordField MkFieldFlag) where ... Source #

A Flag (1-bit) that is true if the type level maybe is Just.

type family FlagNothing (a :: Maybe (v :: Type)) :: IsA (BitRecordField MkFieldFlag) where ... Source #

A Flag (1-bit) that is true if the type level maybe is Nothing.

data MaybeField :: Maybe (IsA (BitRecordField t)) -> IsA BitRecord Source #

An optional field in a bit record

Instances

type Eval BitRecord (MaybeField rt k st len t (Nothing (IsA Type (BitRecordField rt k st len t)))) Source # 
type Eval BitRecord (MaybeField rt k st len t (Nothing (IsA Type (BitRecordField rt k st len t)))) = EmptyBitRecord
type Eval BitRecord (MaybeField rt k st len t (Just (IsA Type (BitRecordField rt k st len t)) fld)) Source # 
type Eval BitRecord (MaybeField rt k st len t (Just (IsA Type (BitRecordField rt k st len t)) fld)) = BitRecordMember rt k st len t fld

data RecordField :: IsA (BitRecordField t) -> IsA BitRecord Source #

Instances

type Eval BitRecord (RecordField rt k st len t f) Source # 
type Eval BitRecord (RecordField rt k st len t f) = BitRecordMember rt k st len t f

type family BitRecordFieldSize (x :: IsA (BitRecordField t)) where ... Source #

Calculate the size as a number of bits from a BitRecordField

Equations

BitRecordFieldSize (x :: IsA (BitRecordField (t :: BitField rt st size))) = size 

Field and Record PrettyType Instances

showARecord :: forall proxy rec. PrettyTypeShow (PrettyRecord (Eval rec)) => proxy rec -> String Source #

Render rec to a pretty, human readable form. Internally this is a wrapper around ptShow using PrettyRecord.

showRecord :: forall proxy rec. PrettyTypeShow (PrettyRecord rec) => proxy rec -> String Source #

Render rec to a pretty, human readable form. Internally this is a wrapper around ptShow using PrettyRecord.

type family PrettyField (f :: IsA (BitRecordField (t :: BitField (rt :: Type) (st :: Type) (size :: Nat)))) :: PrettyType where ... Source #

type family PrettyFieldValue (t :: BitField (rt :: Type) (st :: Type) (size :: Nat)) (v :: st) :: PrettyType where ... Source #

Equations

PrettyFieldValue MkFieldFlag True = PutStr "yes" 
PrettyFieldValue MkFieldFlag False = PutStr "no" 
PrettyFieldValue (MkFieldBits :: BitField (B (s :: Nat)) Nat s) v = PrettyNat PrettyUnpadded (PrettyPrecision s) PrettyBit v <+> PrettyParens (("hex" <:> PutHex v) <+> ("dec" <:> PutNat v)) 
PrettyFieldValue MkFieldU8 v = ("hex" <:> PutHex8 v) <+> PrettyParens ("dec" <:> PutNat v) 
PrettyFieldValue MkFieldU16 v = ("hex" <:> PutHex16 v) <+> PrettyParens ("dec" <:> PutNat v) 
PrettyFieldValue MkFieldU32 v = ("hex" <:> PutHex32 v) <+> PrettyParens ("dec" <:> PutNat v) 
PrettyFieldValue MkFieldU64 v = ("hex" <:> PutHex64 v) <+> PrettyParens ("dec" <:> PutNat v) 
PrettyFieldValue MkFieldI8 (PositiveNat v) = ("hex" <:> (PutStr "+" <++> PutHex8 v)) <+> PrettyParens ("dec" <:> (PutStr "+" <++> PutNat v)) 
PrettyFieldValue MkFieldI16 (PositiveNat v) = ("hex" <:> (PutStr "+" <++> PutHex16 v)) <+> PrettyParens ("dec" <:> (PutStr "+" <++> PutNat v)) 
PrettyFieldValue MkFieldI32 (PositiveNat v) = ("hex" <:> (PutStr "+" <++> PutHex32 v)) <+> PrettyParens ("dec" <:> (PutStr "+" <++> PutNat v)) 
PrettyFieldValue MkFieldI64 (PositiveNat v) = ("hex" <:> (PutStr "+" <++> PutHex64 v)) <+> PrettyParens ("dec" <:> (PutStr "+" <++> PutNat v)) 
PrettyFieldValue MkFieldI8 (NegativeNat v) = ("hex" <:> (PutStr "-" <++> PutHex8 v)) <+> PrettyParens ("dec" <:> (PutStr "-" <++> PutNat v)) 
PrettyFieldValue MkFieldI16 (NegativeNat v) = ("hex" <:> (PutStr "-" <++> PutHex16 v)) <+> PrettyParens ("dec" <:> (PutStr "-" <++> PutNat v)) 
PrettyFieldValue MkFieldI32 (NegativeNat v) = ("hex" <:> (PutStr "-" <++> PutHex32 v)) <+> PrettyParens ("dec" <:> (PutStr "-" <++> PutNat v)) 
PrettyFieldValue MkFieldI64 (NegativeNat v) = ("hex" <:> (PutStr "-" <++> PutHex64 v)) <+> PrettyParens ("dec" <:> (PutStr "-" <++> PutNat v)) 
PrettyFieldValue (MkFieldCustom :: BitField rt ct size) v = PrettyCustomFieldValue rt ct size v