Module Byte

Byte operations and byte classes.

type Byte = Byte

A primitive type representing a single byte.

type Byte.Class = either {
  .any!,
  .byte Byte,
  .range(Byte, Byte)!,
}

A class of bytes for parsers and Byte.Is.

  • .any! — any byte.
  • .byte b — a specific byte.
  • .range(lo, hi)! — bytes in the inclusive range [lo, hi].
dec Byte.Code : [Byte] Nat

Returns the numeric value of a byte (0-255) as a natural number.

dec Byte.FromCode : [Nat] Byte

Converts a natural number to a byte modulo 256.