package grace

  1. Overview
  2. Docs

Module type Grace.IndexSource

type t = private int

The type of indexes. An integer with the invariant that an index t satisfies t >= 0.

include Sexplib0.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
val sexp_of_t : t -> Sexplib0.Sexp.t
include Grace_std.Comparable.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 min : t -> t -> t
val max : t -> t -> t
include Grace_std.Pretty_printer.S with type t := t
val pp : t Fmt.t
val to_string : t -> string
val of_int : int -> t

of_int n creates the index n.

val initial : t

initial is the initial index, namely 0.

val add : t -> int -> t

add t off adds the offset off to the index t.

val sub : t -> int -> t

sub t off subtracts the offset off from the index t.

val diff : t -> t -> int

diff t1 t2 returns the (potentially negative) difference between t1 and t2.