An ongoing numbering of (a subset of) a type t.

type t

The type t of values of interest.

val encode : t -> int

encode maps a value of type t to a unique integer code. If applied twice to the same value, encode returns the same code; if applied to a value that has never been encountered, it returns a fresh code.

val current : unit -> int

current() returns the next available code, which is also the number of values that have been encoded so far.

val has_been_encoded : t -> bool

has_been_encoded x determines whether the value x has been encoded already.