Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data NullPad (n :: Natural)
- type NullPadded n a = Refined (NullPad n) a
Documentation
data NullPad (n :: Natural) Source #
Instances
(BLen a, KnownNat n) => Predicate (NullPad n :: Type) a Source # | |
Defined in Binrep.Type.NullPadded | |
(BLen a, Get a, KnownNat n) => Get (NullPadded n a) Source # | |
Defined in Binrep.Type.NullPadded get :: Getter (NullPadded n a) Source # | |
(BLen a, Put a, KnownNat n) => Put (NullPadded n a) Source # | |
Defined in Binrep.Type.NullPadded put :: NullPadded n a -> Poke Source # |
type NullPadded n a = Refined (NullPad n) a Source #
A type which is to be null-padded to a given total length.
Given some a ::
, it is guaranteed thatNullPadded
n a
blen
a<=
natValInt
@n
thus
natValInt
@n-
blen
a>=
0
That is, the serialized stored data will not be longer than the total length.
The binrep instances are careful not to construct bytestrings unnecessarily.