binrep-0.8.0: Encode precise binary representations directly in types
Safe HaskellSafe-Inferred
LanguageGHC2021

Binrep.Type.Derived.NullTermPadded

Description

Null-terminated, then null-padded data.

This is defined using the composition of existing NullTerminate and NullPad predicates, plus the re-associating binrep instances for the And predicate combinator. It kind of just magically works.

Synopsis

Documentation

type NullTermPad n = NullTerminate `And` NullPad n Source #

Predicate for null-terminated, then null-padded data.

type NullTermPadded n = Refined (NullTermPad n) Source #

Null-terminated data, which is then null-padded to the given length.

Instantiate with ByteString for a null-padded C string.