isobmff-0.14.0.0: A parser and generator for the ISO-14496-12/14 base media file format

Safe HaskellNone
LanguageHaskell2010

Data.Type.BitRecords.Core

Contents

Description

NamedStructure definition for sequences of bits.

This module provides the core data types and functions for conversion of finite bit sequences from an to conventional (Haskell) data types.

Non-compressed, non-random finite bit sequences generated by programs are usually compositions of bytes and multi byte words, and a ton of Haskell libraries exist for the serialization and deserialization of ByteStrings.

This module allows the definition of a structure i.e. a very simple grammar, which allows functions in this library to read and write single bytes, words and bits.

Also complete bit sequence may be constructed or destructed from and to Haskell types.

Further more, the structures may contain dependent sub-sequences, for example to express structures that precede a length field before a repetitive block data.

Antother example for dependent sequences is fields whose presence depends on flags preceding them.

This library is also designed with zero copying in mind.

It should be emphasized that binary deserialization is not to be confused with binary destructuring. While the former usually involves copying all regular sub sequences from the input to a value of a certain type, the later merely requires to peek into the sequeuence at a certain position and deserializing a sub sequence. The starting position and the interpretation are governed by the strucuture applied to the sequence.

Synopsis

Bit-Records

Bit-Record Type

data BitRecord where Source #

BitRecordFields assembly

Instances
HasFunctionBuilder BitBuilder (Proxy (From r)) => HasFunctionBuilder BitBuilder (Proxy r) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy r) r :: Type #

HasFunctionBuilder BitBuilder (Proxy EmptyBitRecord) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy EmptyBitRecord) r :: Type #

HasFunctionBuilder BitBuilder (Proxy f) => HasFunctionBuilder BitBuilder (Proxy (BitRecordMember f)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (BitRecordMember f)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy f) => HasFunctionBuilder BitBuilder (Proxy (RecordField f)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (RecordField f)) r :: Type #

(HasFunctionBuilder BitBuilder (Proxy l), HasFunctionBuilder BitBuilder (Proxy r)) => HasFunctionBuilder BitBuilder (Proxy (BitRecordAppend l r)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (BitRecordAppend l r)) r :: Type #

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

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

type Apply (BitRecordAppendFun_ l :: (BitRecord -> BitRecord) -> Type) (r :: BitRecord) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

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

Defined in Data.ByteString.Mp4.Boxes.Expandable

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

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

type From (l :+^ r :: BitRecord -> Type) = Append l (From r)
type ToFunction BitBuilder (Proxy r) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy EmptyBitRecord) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (BitRecordMember f)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (RecordField f)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type Apply (BitRecordOfDescriptor :: (Descriptor tag -> BitRecord) -> Type) (MkDescriptor body :: Descriptor tag) Source # 
Instance details

Defined in Data.ByteString.Mp4.Boxes.BaseDescriptor

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

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Sized

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

Defined in Data.Type.BitRecords.Core

type From (MaybeField (Nothing :: Maybe (Extends (BitRecordField t))) :: BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Sized

type From (SizedField sf r :: BitRecord -> Type) = (("size" @: sf) := SizeInBytes r) .+. r

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 SizeInBits (x :: k) :: Nat where ... Source #

Get the number of bits in a BitRecord

type family SizeInBytes (c :: k) :: Nat Source #

For something to be augmented by a size field there must be an instance of this family to generate the value of the size field, e.g. by counting the elements.

Instances
type SizeInBytes (b :: BitRecord) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type SizeInBytes (Labelled l f :: a -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type SizeInBytes (Labelled l f :: a -> Type) = SizeInBytes f
type SizeInBytes (f :=. v :: BitField rt k size -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type SizeInBytes (f :=. v :: BitField rt k size -> Type) = SizeInBytes v
type SizeInBytes (MkField t :: BitRecordField t -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type SizeInBytes (f := v :: BitRecordField t -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

type SizeInBytes (t :: BitField rt st size) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type SizeInBytes (t :: BitField rt st size) = size

type Bits2Bytes (bitSize :: Nat) = Bits2Bytes2 (Div bitSize 8) (Mod bitSize 8) Source #

type family Bits2Bytes2 (bitSizeDiv8 :: Nat) (bitSizeMod8 :: Nat) :: Nat where ... Source #

Equations

Bits2Bytes2 bytes 0 = bytes 
Bits2Bytes2 bytes n = bytes + 1 

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

Get the size of the record.

type OptionalRecordOf (f :: Extends (s -> Extends BitRecord)) (x :: Maybe s) = (Optional (Konst EmptyBitRecord) f $ x :: Extends BitRecord) Source #

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

Record composition

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

Defined in Data.Type.BitRecords.Core

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

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

Defined in Data.Type.BitRecords.Core

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

Append a BitRecord and a BitRecordField

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

Append a BitRecordField and a BitRecord

type (.+.) (l :: Extends (BitRecordField t1)) (r :: Extends (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 :: Extends (BitRecordField (t :: BitField (rt :: Type) (st :: k) (len :: Nat)))) :~ (value :: Extends (FieldValue (label :: Symbol) st)) :: Extends (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 :: Extends (BitRecordField (t :: BitField (rt :: Type) (st :: k) (len :: Nat)))) :~? (value :: Maybe (Extends (FieldValue (label :: Symbol) st))) :: Extends 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 = Konst EmptyBitRecord 

type family (fld :: Extends (BitRecordField (t :: BitField (rt :: Type) (st :: k) (len :: Nat)))) :+? (value :: Maybe (Extends (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 -> Extends (FieldValue label staticRep) Source #

data RuntimeFieldValue (label :: Symbol) :: Extends (FieldValue label staticRep) Source #

Record Arrays and Repitition

data RecArray :: BitRecord -> Nat -> Extends 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 From (RecArray r n :: 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 :: Extends (foo -> BitRecord)) (xs :: [foo]) :: Extends BitRecord Source #

Let type level lists also be records

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

Defined in Data.Type.BitRecords.Core

Maybe Record

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

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

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

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

type From (OptionalRecord (Just t) :: 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
HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldFlag)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldFlag)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI8)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI8)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI16)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI16)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI32)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI32)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI64)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI64)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldU8)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldU8)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldU16)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldU16)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldU32)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldU32)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldU64)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldU64)) r :: Type #

(KnownNat v, DynamicContent BitBuilder (Proxy f) rt, Num rt) => HasFunctionBuilder BitBuilder (Proxy (f := v)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := v)) r :: Type #

(KnownNat v, DynamicContent BitBuilder (Proxy f) x, Num x) => HasFunctionBuilder BitBuilder (Proxy (f := NegativeNat v)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := NegativeNat v)) r :: Type #

(KnownNat v, DynamicContent BitBuilder (Proxy f) x, Num x) => HasFunctionBuilder BitBuilder (Proxy (f := PositiveNat v)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := PositiveNat v)) r :: Type #

FieldWidth f ~ 1 => HasFunctionBuilder BitBuilder (Proxy (f := False)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := False)) r :: Type #

FieldWidth f ~ 1 => HasFunctionBuilder BitBuilder (Proxy (f := True)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := True)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy nested) => HasFunctionBuilder BitBuilder (Proxy (LabelF l nested)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (LabelF l nested)) r :: Type #

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldBits)) r :: Type #

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

Defined in Data.Type.BitRecords.Enum

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldCustom)) r :: Type #

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

Defined in Data.Type.BitRecords.Enum

Associated Types

type ToFunction BitBuilder (Proxy (f := v)) r :: Type #

DynamicContent BitBuilder (Proxy (MkField MkFieldI8)) Int8 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldI16)) Int16 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldI32)) Int32 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldI64)) Int64 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldU8)) Word8 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldU16)) Word16 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldU32)) Word32 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldU64)) Word64 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy nested) b => DynamicContent BitBuilder (Proxy (LabelF l nested)) b Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Methods

addParameter :: Proxy (LabelF l nested) -> FunctionBuilder BitBuilder next (b -> next) #

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldFlag)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldU8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldU16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldU32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldU64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f := NegativeNat v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f := PositiveNat v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f := v)) r = r
type ToFunction BitBuilder (Proxy (f := False)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f := True)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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

Defined in Data.Type.BitRecords.Enum

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

Defined in Data.Type.BitRecords.Enum

type ToFunction BitBuilder (Proxy (f := v)) r = r
type From (MaybeField (Nothing :: Maybe (Extends (BitRecordField t))) :: BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

type SizeInBytes (f := v :: BitRecordField t -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

data MkField t :: BitRecordField t -> Type Source #

A bit record field with a number of bits

Instances
HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldFlag)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldFlag)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI8)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI8)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI16)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI16)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI32)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI32)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI64)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI64)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldU8)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldU8)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldU16)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldU16)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldU32)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldU32)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldU64)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldU64)) r :: Type #

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldBits)) r :: Type #

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

Defined in Data.Type.BitRecords.Enum

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldCustom)) r :: Type #

DynamicContent BitBuilder (Proxy (MkField MkFieldI8)) Int8 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldI16)) Int16 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldI32)) Int32 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldI64)) Int64 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldU8)) Word8 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldU16)) Word16 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldU32)) Word32 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldU64)) Word64 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldFlag)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldU8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldU16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldU32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldU64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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

Defined in Data.Type.BitRecords.Enum

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

Defined in Data.Type.BitRecords.Core

Setting a Label

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

A bit record field with a number of bits

Instances
HasFunctionBuilder BitBuilder (Proxy nested) => HasFunctionBuilder BitBuilder (Proxy (LabelF l nested)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (LabelF l nested)) r :: Type #

DynamicContent BitBuilder (Proxy nested) b => DynamicContent BitBuilder (Proxy (LabelF l nested)) b Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Methods

addParameter :: Proxy (LabelF l nested) -> FunctionBuilder BitBuilder next (b -> next) #

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (LabelF l nested)) a = ToFunction BitBuilder (Proxy nested) a
type SizeInBytes (LabelF l f :: BitRecordField t -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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

A field with a label assigned to it.

type (@::) (l :: Symbol) (f :: Extends a) = Labelled l f infixr 8 Source #

A field with a label assigned to it.

Assignment

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

A field with a value set at compile time.

Instances
(KnownNat v, DynamicContent BitBuilder (Proxy f) rt, Num rt) => HasFunctionBuilder BitBuilder (Proxy (f := v)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := v)) r :: Type #

(KnownNat v, DynamicContent BitBuilder (Proxy f) x, Num x) => HasFunctionBuilder BitBuilder (Proxy (f := NegativeNat v)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := NegativeNat v)) r :: Type #

(KnownNat v, DynamicContent BitBuilder (Proxy f) x, Num x) => HasFunctionBuilder BitBuilder (Proxy (f := PositiveNat v)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := PositiveNat v)) r :: Type #

FieldWidth f ~ 1 => HasFunctionBuilder BitBuilder (Proxy (f := False)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := False)) r :: Type #

FieldWidth f ~ 1 => HasFunctionBuilder BitBuilder (Proxy (f := True)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := True)) r :: Type #

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

Defined in Data.Type.BitRecords.Enum

Associated Types

type ToFunction BitBuilder (Proxy (f := v)) r :: Type #

type ToFunction BitBuilder (Proxy (f := NegativeNat v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f := PositiveNat v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f := v)) r = r
type ToFunction BitBuilder (Proxy (f := False)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f := True)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f := True)) r = r
type ToFunction BitBuilder (Proxy (f := v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Enum

type ToFunction BitBuilder (Proxy (f := v)) r = r
type SizeInBytes (f := v :: BitRecordField t -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

data (:=.) :: Extends (BitField rt st size) -> st -> Extends (BitField rt st size) infixl 7 Source #

A field with a value set at compile time.

Instances
(KnownNat v, DynamicContent BitBuilder (Proxy f) rt, Num rt) => HasFunctionBuilder BitBuilder (Proxy (f :=. v)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f :=. v)) r :: Type #

BitFieldSize (From f) ~ 1 => HasFunctionBuilder BitBuilder (Proxy (f :=. False)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f :=. False)) r :: Type #

BitFieldSize (From f) ~ 1 => HasFunctionBuilder BitBuilder (Proxy (f :=. True)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f :=. True)) r :: Type #

type ToFunction BitBuilder (Proxy (f :=. v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f :=. v)) r = r
type ToFunction BitBuilder (Proxy (f :=. False)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f :=. True)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type SizeInBytes (f :=. v :: BitField rt k size -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type SizeInBytes (f :=. v :: BitField rt k size -> Type) = SizeInBytes v

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.

Instances
(KnownNat v, DynamicContent BitBuilder (Proxy f) rt, Num rt) => HasFunctionBuilder BitBuilder (Proxy (f :=. v)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f :=. v)) r :: Type #

BitFieldSize (From f) ~ 1 => HasFunctionBuilder BitBuilder (Proxy (f :=. False)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f :=. False)) r :: Type #

BitFieldSize (From f) ~ 1 => HasFunctionBuilder BitBuilder (Proxy (f :=. True)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f :=. True)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy nested) => HasFunctionBuilder BitBuilder (Proxy (Labelled l nested)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (Labelled l nested)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy nested) => HasFunctionBuilder BitBuilder (Proxy (Konst nested)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (Konst nested)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy MkFieldFlag) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy MkFieldFlag) r :: Type #

HasFunctionBuilder BitBuilder (Proxy MkFieldU32) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy MkFieldU32) r :: Type #

DynamicContent BitBuilder (Proxy nested) rt => DynamicContent BitBuilder (Proxy (Labelled l nested)) rt Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Methods

addParameter :: Proxy (Labelled l nested) -> FunctionBuilder BitBuilder next (rt -> next) #

DynamicContent BitBuilder (Proxy nested) rt => DynamicContent BitBuilder (Proxy (Konst nested)) rt Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Methods

addParameter :: Proxy (Konst nested) -> FunctionBuilder BitBuilder next (rt -> next) #

DynamicContent BitBuilder (Proxy MkFieldFlag) Bool Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy MkFieldU32) Word32 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f :=. v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f :=. v)) r = r
type ToFunction BitBuilder (Proxy (f :=. False)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f :=. True)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (Labelled l nested)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (Labelled l nested)) a = ToFunction BitBuilder (Proxy nested) a
type ToFunction BitBuilder (Proxy (Konst nested)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (Konst nested)) a = ToFunction BitBuilder (Proxy nested) a
type ToFunction BitBuilder (Proxy MkFieldFlag) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy MkFieldU32) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type SizeInBytes (f :=. v :: BitField rt k size -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type SizeInBytes (f :=. v :: BitField rt k size -> Type) = SizeInBytes v
type SizeInBytes (t :: BitField rt st size) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

type SizeInBytes (t :: BitField rt st size) = size

type family BitFieldSize (b :: BitField rt st size) :: Nat where ... Source #

Equations

BitFieldSize (b :: BitField rt st size) = size 

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
KnownChunkSize s => HasFunctionBuilder BitBuilder (Proxy (MkField (MkFieldBits :: BitField (B s) Nat s))) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldBits)) r :: Type #

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

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 #

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

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (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
HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI8)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI8)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI16)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI16)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI32)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI32)) r :: Type #

HasFunctionBuilder BitBuilder (Proxy (MkField MkFieldI64)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (MkField MkFieldI64)) r :: Type #

(KnownNat v, DynamicContent BitBuilder (Proxy f) x, Num x) => HasFunctionBuilder BitBuilder (Proxy (f := NegativeNat v)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := NegativeNat v)) r :: Type #

(KnownNat v, DynamicContent BitBuilder (Proxy f) x, Num x) => HasFunctionBuilder BitBuilder (Proxy (f := PositiveNat v)) Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Associated Types

type ToFunction BitBuilder (Proxy (f := PositiveNat v)) r :: Type #

DynamicContent BitBuilder (Proxy (MkField MkFieldI8)) Int8 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldI16)) Int16 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldI32)) Int32 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

DynamicContent BitBuilder (Proxy (MkField MkFieldI64)) Int64 Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI8)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI16)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI32)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (MkField MkFieldI64)) a Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f := NegativeNat v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

type ToFunction BitBuilder (Proxy (f := PositiveNat v)) r Source # 
Instance details

Defined in Data.Type.BitRecords.Builder.LazyByteStringBuilder

Composed Fields

type family FlagJust (a :: Maybe (v :: Type)) :: Extends (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)) :: Extends (BitRecordField MkFieldFlag) where ... Source #

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

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

An optional field in a bit record

Instances
type From (MaybeField (Nothing :: Maybe (Extends (BitRecordField t))) :: BitRecord -> Type) Source # 
Instance details

Defined in Data.Type.BitRecords.Core

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

Defined in Data.Type.BitRecords.Core

type family FieldWidth (x :: Extends (BitRecordField t)) where ... Source #

Calculate the size as a number of bits from a BitRecordField

Equations

FieldWidth (x :: Extends (BitRecordField (t :: BitField rt st size))) = size 

Field and Record PrettyType Instances

showARecord :: forall proxy (rec :: Extends BitRecord). PrettyTypeShow (PrettyRecord (From 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 :: Extends (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))