Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data EnumOf enum where
- type BitRecordOfEnum e = (RenderEnumOf (Eval e) :: BitRecord)
- type family RenderEnumOf (e :: EnumOf enum) :: BitRecord where ...
- data EnumField enum size
- type BitRecordFieldOfEnumField x = MkField (MkFieldCustom :: BitField (EnumValue e) e s)
- data FixedEnum enum size :: IsAn (EnumField enum size)
- data ExtEnum enum size extInd extField :: IsAn (EnumField enum size)
- data SetEnum l ef v :: IsAn (EnumOf enum)
- data EnumParam label ef :: IsAn (EnumOf enum)
- data SetEnumAlt l ef v :: IsAn (EnumOf enum)
- data EnumParamAlt label ef :: IsAn (EnumOf enum)
- type family FromEnum enum (entry :: enum) :: Nat
- data EnumValue e where
- MkEnumValue :: KnownNat (FromEnum e v) => Proxy (v :: e) -> EnumValue e
- enumValueProxy :: KnownNat (FromEnum e v) => Proxy (v :: e) -> EnumValue e
- fromEnumValue :: EnumValue e -> Word64
BitRecordFields containing enum-like types
data EnumOf enum where Source #
Wrapper around a type that can be represented as a short number, indexing the clauses of the (sum) type.
type Eval (EnumOf enum) (EnumParamAlt enum size label (FixedEnum enum size)) Source # | |
type Eval (EnumOf enum) (EnumParamAlt enum size label (ExtEnum rt k st len t enum size extInd extField)) Source # | |
type Eval (EnumOf enum) (EnumParam enum size label ei) Source # | |
type Eval (EnumOf enum) (SetEnum enum size l ei value) Source # | |
type Eval (EnumOf enum) (SetEnumAlt k enum size l (FixedEnum enum size) value) Source # | |
type Eval (EnumOf enum) (SetEnumAlt st enum size l (ExtEnum rt * st len t enum size extInd extField) value) Source # | |
type BitRecordOfEnum e = (RenderEnumOf (Eval e) :: BitRecord) Source #
type family RenderEnumOf (e :: EnumOf enum) :: BitRecord where ... Source #
RenderEnumOf (MkEnumOf mainField mainFieldVal extra) = (BitRecordFieldOfEnumField mainField :~ mainFieldVal) .+: extra |
type BitRecordFieldOfEnumField x = MkField (MkFieldCustom :: BitField (EnumValue e) e s) Source #
data ExtEnum enum size extInd extField :: IsAn (EnumField enum size) Source #
An enum that can be extended with an additional BitRecordField
, following
the regular enum field; the extension is optional, i.e. only if the
regular field contains a special value (e.g. 0xff).
data SetEnum l ef v :: IsAn (EnumOf enum) Source #
Create an EnumOf
that sets an enum to a static value.
data EnumParam label ef :: IsAn (EnumOf enum) Source #
Create an EnumOf
that sets the enum to a runtime value.
data SetEnumAlt l ef v :: IsAn (EnumOf enum) Source #
Create an EnumOf
that sets an extended enum to an extended static value.
data EnumParamAlt label ef :: IsAn (EnumOf enum) Source #
Create an EnumOf
that sets the extended enum to a runtime value.
Composing BitRecords with enum fields
type family FromEnum enum (entry :: enum) :: Nat Source #
Return the numeric index of an entry in a table. This emulates fromEnum
a bit.
data EnumValue e where Source #
An enum value supplied at runtime.
MkEnumValue :: KnownNat (FromEnum e v) => Proxy (v :: e) -> EnumValue e |
fromEnumValue :: EnumValue e -> Word64 Source #