Module Tezos_raw_protocol_026_PtUSHuai.Cycle_repr

This module provides a type and functions to manipulate cycle numbers.

Invariant: cycle numbers are always positive.

type t
type cycle = t
include Tezos_protocol_environment_026_PtUSHuai.Compare.S with type t := t
val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (<) : t -> t -> bool
val (<=) : t -> t -> bool
val (>=) : t -> t -> bool
val (>) : t -> t -> bool
val compare : t -> t -> int
val equal : t -> t -> bool
val max : t -> t -> t
val min : t -> t -> t
val root : cycle
val pred : cycle -> cycle option
val add : cycle -> int -> cycle
val sub : cycle -> int -> cycle option

sub c i is Some (c - i) if c - i is a valid (non-negative) cycle, and None otherwise.

The offset i must be non-negative.

  • raises Assert_failure

    if i is negative.

val succ : cycle -> cycle
val diff : cycle -> cycle -> int32
val (--->) : cycle -> cycle -> cycle list

a ---> b = a; ...; b

val to_int32 : cycle -> int32
val of_int32_exn : int32 -> cycle
val of_string_opt : string -> cycle option

of_string_opt s parses s as a non-negative cycle number. It returns None if Int32.of_string_opt s fails or the value is negative.

module Index : Storage_description.INDEX with type t = cycle