Module Http.Digits

Decimal digits codec.

These represent non-negative integers. The module detects overflows and turns them into errors.

val decode : string -> (int, string) Stdlib.result

decode s is the non-empty sequence of decimal digits s as a non-negative integer.

val encode : int -> string

encode_digits n is the non-negative integer n as a sequence of decimal digits.

  • raises Invalid_argument

    if n is negative.