module Counter:int countersig
..end
a counter for non-negative numbers.
type
counter
exception OVERFLOW
val create : unit -> counter
val create_with : int -> counter
create_with start_value
creates a new counter with start_value
. start_value
must be >= 0.val set : counter -> int -> unit
set value
sets the counter to value
. value
must be >= 0.val inc : counter -> unit
OVERFLOW
on overflow.val inc_by : counter -> int -> unit
OVERFLOW
on overflow.val dec : counter -> unit
OVERFLOW
if the counter drops below 0.val next : counter -> int
OVERFLOW
on overflow.val value : counter -> int