isobmff-0.13.0.0: A parser and generator for the ISO-14496-12/14 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 (Eval r)) a => BitStringBuilderHoley (Proxy r) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy r) a :: Type Source #

BitStringBuilderHoley (Proxy EmptyBitRecord) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy EmptyBitRecord) a :: Type Source #

BitStringBuilderHoley (Proxy f) a => BitStringBuilderHoley (Proxy (BitRecordMember f)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (BitRecordMember f)) a :: Type Source #

(BitStringBuilderHoley (Proxy l) (ToBitStringBuilder (Proxy r) a), BitStringBuilderHoley (Proxy r) a) => BitStringBuilderHoley (Proxy (BitRecordAppend l r)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (BitRecordAppend l r)) a :: Type Source #

type ToPretty (rec :: BitRecord) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type ToPretty (rec :: BitRecord) = PrettyRecord rec
type SizeFieldValue (b :: BitRecord) Source # 
Instance details

Defined in Data.Type.BitRecords.Sized

type (BitRecordAppendFun_ l :: A (BitRecord :-> BitRecord) -> Type) $~ (r :: BitRecord) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (OptionalRecord (Nothing :: Maybe BitRecord)) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (OptionalRecord (Just t) :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (OptionalRecord (Just t) :: A BitRecord -> Type) = t
type Eval (StaticExpandableContent record :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.ByteString.Mp4.Boxes.Expandable

type Eval (RecArray r n :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (l :^+ r :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (l :^+ r :: A BitRecord -> Type) = Append (Eval l) r
type Eval (l :+^ r :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (l :+^ r :: A BitRecord -> Type) = Append l (Eval r)
type (BitRecordOfDescriptor :: A (Descriptor tag :-> BitRecord) -> Type) $~ (MkDescriptor body :: Descriptor tag) Source # 
Instance details

Defined in Data.ByteString.Mp4.Boxes.BaseDescriptor

type Eval (BitRecordOfList f xs :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (Sized sf r :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Sized

type Eval (Sized sf r :: A BitRecord -> Type) = (("size" @: sf) := SizeFieldValue r) .+: r
type Eval (RecordField f :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (MaybeField (Nothing :: Maybe (IsA (BitRecordField t))) :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (MaybeField (Just fld) :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (SizedField sf r :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Sized

type Eval (SizedField sf r :: A BitRecord -> Type) = (("size" @: sf) := SizeFieldValue r) .+. r
type ToBitStringBuilder (Proxy r) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy EmptyBitRecord) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (BitRecordMember f)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (BitRecordAppend l r)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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 BitRecordMemberCount (b :: BitRecord) :: Nat where ... Source #

Get the total number of members in a record.

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

Get the size of the record.

type OptionalRecordOf (f :: IsA (s :-> IsA BitRecord)) (x :: Maybe s) = (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 :: BitRecord) :+^ (r :: IsA BitRecord) :: 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 (l :+^ r :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (l :+^ r :: A BitRecord -> Type) = Append l (Eval r)

data (l :: IsA BitRecord) :^+ (r :: BitRecord) :: 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 (l :^+ r :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (l :^+ r :: A BitRecord -> Type) = Append (Eval l) r

type (:+:) (l :: BitRecord) (r :: BitRecord) = (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 :: BitRecord) (f :: IsA (BitRecordField t1)) = Append r (BitRecordMember f) infixl 6 Source #

Append a BitRecord and a BitRecordField

type (.+:) (f :: IsA (BitRecordField t1)) (r :: BitRecord) = Append (BitRecordMember f) r infixr 6 Source #

Append a BitRecordField and a BitRecord

type (.+.) (l :: IsA (BitRecordField t1)) (r :: IsA (BitRecordField t2)) = 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 :: Symbol) :: staticRep -> IsA (FieldValue label staticRep) Source #

data RuntimeFieldValue (label :: Symbol) :: 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 Eval (RecArray r n :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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 :: IsA (foo :-> BitRecord)) (xs :: [foo]) :: IsA BitRecord Source #

Let type level lists also be records

Instances
type Eval (BitRecordOfList f xs :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

Maybe Record

data OptionalRecord :: Maybe BitRecord -> IsA BitRecord Source #

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

Instances
type Eval (OptionalRecord (Nothing :: Maybe BitRecord)) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (OptionalRecord (Just t) :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (OptionalRecord (Just t) :: A BitRecord -> Type) = t

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 (MkField MkFieldFlag)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldFlag)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI8)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI16)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI32)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI64)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldU8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldU8)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldU16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldU16)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldU32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldU32)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldU64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldU64)) a :: Type Source #

(KnownNat v, BitStringBuilderHoley (Proxy f) a, ToBitStringBuilder (Proxy f) a ~ (rt -> a), Num rt) => BitStringBuilderHoley (Proxy (f := v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := v)) a :: Type Source #

(KnownNat v, BitStringBuilderHoley (Proxy f) a, ToBitStringBuilder (Proxy f) a ~ (x -> a), Num x) => BitStringBuilderHoley (Proxy (f := NegativeNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := NegativeNat v)) a :: Type Source #

(KnownNat v, BitStringBuilderHoley (Proxy f) a, ToBitStringBuilder (Proxy f) a ~ (x -> a), Num x) => BitStringBuilderHoley (Proxy (f := PositiveNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := PositiveNat v)) a :: Type Source #

BitRecordFieldSize f ~ 1 => BitStringBuilderHoley (Proxy (f := False)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := False)) a :: Type Source #

BitRecordFieldSize f ~ 1 => BitStringBuilderHoley (Proxy (f := True)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := True)) a :: Type Source #

BitStringBuilderHoley (Proxy nested) a => BitStringBuilderHoley (Proxy (LabelF l nested)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (LabelF l nested)) a :: Type Source #

KnownChunkSize s => BitStringBuilderHoley (Proxy (MkField (MkFieldBits :: BitField (B s) Nat s))) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldBits)) a :: Type Source #

KnownChunkSize size => BitStringBuilderHoley (Proxy (MkField (MkFieldCustom :: BitField (EnumValue e) e size))) r Source # 
Instance details

Defined in Data.Type.BitRecords.Enum

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldCustom)) r :: Type Source #

(KnownNat (FromEnum e v), KnownChunkSize size) => BitStringBuilderHoley (Proxy (f := v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Enum

Associated Types

type ToBitStringBuilder (Proxy (f := v)) r :: Type Source #

type Eval (MaybeField (Nothing :: Maybe (IsA (BitRecordField t))) :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (MaybeField (Just fld) :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type ToPretty (f :: IsA (BitRecordField t)) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type ToBitStringBuilder (Proxy (MkField MkFieldFlag)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldU8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldU16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldU32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldU64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := NegativeNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := PositiveNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := v)) a = a
type ToBitStringBuilder (Proxy (f := False)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := False)) a = a
type ToBitStringBuilder (Proxy (f := True)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := True)) a = a
type ToBitStringBuilder (Proxy (LabelF l nested)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (LabelF l nested)) a = ToBitStringBuilder (Proxy nested) a
type ToBitStringBuilder (Proxy (MkField (MkFieldBits :: BitField (B s) Nat s))) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField (MkFieldBits :: BitField (B s) Nat s))) a = B s -> a
type ToBitStringBuilder (Proxy (MkField (MkFieldCustom :: BitField (EnumValue e) e size))) r Source # 
Instance details

Defined in Data.Type.BitRecords.Enum

type ToBitStringBuilder (Proxy (f := v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Enum

type ToBitStringBuilder (Proxy (f := v)) r = r
type SizeFieldValue (MkField t :: A (BitRecordField t) -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Sized

type SizeFieldValue (MkField t :: A (BitRecordField t) -> Type) = size
type SizeFieldValue (f := v :: A (BitRecordField t) -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Sized

type SizeFieldValue (LabelF l f :: A (BitRecordField t) -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Sized

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

A bit record field with a number of bits

Instances
BitStringBuilderHoley (Proxy (MkField MkFieldFlag)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldFlag)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI8)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI16)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI32)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI64)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldU8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldU8)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldU16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldU16)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldU32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldU32)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldU64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldU64)) a :: Type Source #

KnownChunkSize s => BitStringBuilderHoley (Proxy (MkField (MkFieldBits :: BitField (B s) Nat s))) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldBits)) a :: Type Source #

KnownChunkSize size => BitStringBuilderHoley (Proxy (MkField (MkFieldCustom :: BitField (EnumValue e) e size))) r Source # 
Instance details

Defined in Data.Type.BitRecords.Enum

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldCustom)) r :: Type Source #

type ToBitStringBuilder (Proxy (MkField MkFieldFlag)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldU8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldU16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldU32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldU64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField (MkFieldBits :: BitField (B s) Nat s))) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField (MkFieldBits :: BitField (B s) Nat s))) a = B s -> a
type ToBitStringBuilder (Proxy (MkField (MkFieldCustom :: BitField (EnumValue e) e size))) r Source # 
Instance details

Defined in Data.Type.BitRecords.Enum

type SizeFieldValue (MkField t :: A (BitRecordField t) -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Sized

type SizeFieldValue (MkField t :: A (BitRecordField t) -> Type) = 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 nested) a => BitStringBuilderHoley (Proxy (LabelF l nested)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (LabelF l nested)) a :: Type Source #

type ToBitStringBuilder (Proxy (LabelF l nested)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (LabelF l nested)) a = ToBitStringBuilder (Proxy nested) a
type SizeFieldValue (LabelF l f :: A (BitRecordField t) -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Sized

type (@:) (l :: Symbol) (f :: IsA (BitRecordField (t :: BitField rt (st :: stk) size))) = (LabelF l f :: IsA (BitRecordField t)) infixr 8 Source #

A field with a label assigned to it.

Assignment

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

A field with a value set at compile time.

Instances
(KnownNat v, BitStringBuilderHoley (Proxy f) a, ToBitStringBuilder (Proxy f) a ~ (rt -> a), Num rt) => BitStringBuilderHoley (Proxy (f := v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := v)) a :: Type Source #

(KnownNat v, BitStringBuilderHoley (Proxy f) a, ToBitStringBuilder (Proxy f) a ~ (x -> a), Num x) => BitStringBuilderHoley (Proxy (f := NegativeNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := NegativeNat v)) a :: Type Source #

(KnownNat v, BitStringBuilderHoley (Proxy f) a, ToBitStringBuilder (Proxy f) a ~ (x -> a), Num x) => BitStringBuilderHoley (Proxy (f := PositiveNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := PositiveNat v)) a :: Type Source #

BitRecordFieldSize f ~ 1 => BitStringBuilderHoley (Proxy (f := False)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := False)) a :: Type Source #

BitRecordFieldSize f ~ 1 => BitStringBuilderHoley (Proxy (f := True)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := True)) a :: Type Source #

(KnownNat (FromEnum e v), KnownChunkSize size) => BitStringBuilderHoley (Proxy (f := v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Enum

Associated Types

type ToBitStringBuilder (Proxy (f := v)) r :: Type Source #

type ToBitStringBuilder (Proxy (f := NegativeNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := PositiveNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := v)) a = a
type ToBitStringBuilder (Proxy (f := False)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := False)) a = a
type ToBitStringBuilder (Proxy (f := True)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := True)) a = a
type ToBitStringBuilder (Proxy (f := v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Enum

type ToBitStringBuilder (Proxy (f := v)) r = r
type SizeFieldValue (f := v :: A (BitRecordField t) -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Sized

data BitField (runtimeRep :: Type) (staticRep :: k) (bitCount :: Nat) 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 :: Nat) 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 # 
Instance details

Defined in Data.Type.BitRecords.Core

Methods

minBound :: B size #

maxBound :: B size #

Enum (B size) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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 # 
Instance details

Defined in Data.Type.BitRecords.Core

Methods

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

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

Integral (B size) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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 # 
Instance details

Defined in Data.Type.BitRecords.Core

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 # 
Instance details

Defined in Data.Type.BitRecords.Core

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 # 
Instance details

Defined in Data.Type.BitRecords.Core

Methods

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

readList :: ReadS [B size] #

readPrec :: ReadPrec (B size) #

readListPrec :: ReadPrec [B size] #

Real (B size) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

Methods

toRational :: B size -> Rational #

Show (B size) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

Methods

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

show :: B size -> String #

showList :: [B size] -> ShowS #

(PrintfArg Word64, n <= 64) => PrintfArg (B n) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

Bits (B size) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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 # 
Instance details

Defined in Data.Type.BitRecords.Core

Methods

finiteBitSize :: B size -> Int #

countLeadingZeros :: B size -> Int #

countTrailingZeros :: B size -> Int #

KnownChunkSize s => BitStringBuilderHoley (Proxy (MkField (MkFieldBits :: BitField (B s) Nat s))) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldBits)) a :: Type Source #

type ToBitStringBuilder (Proxy (MkField (MkFieldBits :: BitField (B s) Nat s))) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField (MkFieldBits :: BitField (B s) Nat s))) a = B s -> a

data SignedNat where Source #

A signed field value.

Constructors

PositiveNat :: Nat -> SignedNat 
NegativeNat :: Nat -> SignedNat 
Instances
BitStringBuilderHoley (Proxy (MkField MkFieldI8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI8)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI16)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI32)) a :: Type Source #

BitStringBuilderHoley (Proxy (MkField MkFieldI64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (MkField MkFieldI64)) a :: Type Source #

(KnownNat v, BitStringBuilderHoley (Proxy f) a, ToBitStringBuilder (Proxy f) a ~ (x -> a), Num x) => BitStringBuilderHoley (Proxy (f := NegativeNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := NegativeNat v)) a :: Type Source #

(KnownNat v, BitStringBuilderHoley (Proxy f) a, ToBitStringBuilder (Proxy f) a ~ (x -> a), Num x) => BitStringBuilderHoley (Proxy (f := PositiveNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToBitStringBuilder (Proxy (f := PositiveNat v)) a :: Type Source #

type ToBitStringBuilder (Proxy (MkField MkFieldI8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (MkField MkFieldI64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := NegativeNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToBitStringBuilder (Proxy (f := PositiveNat v)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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 (MaybeField (Nothing :: Maybe (IsA (BitRecordField t))) :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type Eval (MaybeField (Just fld) :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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

Instances
type Eval (RecordField f :: A BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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 :: IsA BitRecord). 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 :: BitRecord). 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 

type family PrettyCustomFieldValue (rt :: Type) (st :: Type) (size :: Nat) (v :: st) :: PrettyType Source #

Instances
type PrettyCustomFieldValue ASizedString ASizedString s (sr :: ASizedString) Source # 
Instance details

Defined in Data.Type.BitRecords.SizedString

type PrettyCustomFieldValue (EnumValue e) e size (v :: e) Source # 
Instance details

Defined in Data.Type.BitRecords.Enum

type PrettyCustomFieldValue (EnumValue e) e size (v :: e) = (PutNat (FromEnum e v) <+> ("hex" <:> PutHex (FromEnum e v))) <+> ("bin" <:> PutBits (FromEnum e v))