Module Support.Int

include module type of Stdlib.Int
type t = int
val zero : int
val one : int
val minus_one : int
val neg : int -> int
val add : int -> int -> int
val sub : int -> int -> int
val mul : int -> int -> int
val div : int -> int -> int
val rem : int -> int -> int
val succ : int -> int
val pred : int -> int
val abs : int -> int
val max_int : int
val min_int : int
val logand : int -> int -> int
val logor : int -> int -> int
val logxor : int -> int -> int
val lognot : int -> int
val shift_left : int -> int -> int
val shift_right : int -> int -> int
val shift_right_logical : int -> int -> int
val to_float : int -> float
val of_float : float -> int
val to_string : int -> string

Constructors

val of_string : string -> t

Alias of Stdlib.int_of_string.

val of_string_opt : string -> t option

Alias of Stdlib.int_of_string_opt.

Collections

module Set : Stdlib.Set.S with type elt = t
module Map : Stdlib.Map.S with type key = t
module Hashtbl : Hashtbl.S with type key = t

Instances

include Eq.EQ with type t := t
include Ord.ORD with type t := t
val compare : t -> t -> int

compare a b compares a and b for ordering.

  • compare a b < 0 if a precedes b (denoted a < b),
  • compare a b = 0 if a is equal to b (denoted a = b),
  • compare a b > 0 if a succeeds b (denoted a > b).

This should satisfy the following properties:

  • Comparability: (compare a b <= 0 || compare b a >= 0) = true,
  • Transitivity: if (compare a b <= 0) = true and (compare b c <= 0) = true, then (compare a c <= 0) = true,
  • Reflexivity: (compare a a = 0) = true,
  • Antisymmetry: if (compare a b <= 0) = true and (compare a b >= 0) = true then (compare a b = 0) = true.
val (<) : t -> t -> bool
val (<=) : t -> t -> bool
val (>) : t -> t -> bool
val (>=) : t -> t -> bool
val max : t -> t -> t

max a b is a if a >= b and b otherwise.

val min : t -> t -> t

min a b is a if a <= b and b otherwise.

include Eq.EQ with type t := t
val equal : t -> t -> bool

equal a b is true if and only if a and b are equal. This should satisfy the following properties:

  • Reflexivity: equal a a = true
  • Symmetry: equal a b is equivalent to equal b a
  • Transitivity: if equal a b = true and equal b c = true, then equal a c = true
val (=) : t -> t -> bool

Operator alias of equal.

val (<>) : t -> t -> bool

Negation of operator (=).

include Hash.HASH with type t := t
val hash : t -> int

hash e is the hash code computed for e.

If e1 and e2 as equal, then hash e1 and hash e2 must be equal.

include Show.SHOW with type t := t
val pp : Format.formatter -> t -> unit

pp ppf t emits t pretty-printed to ppf.

val show : t -> string

show t pretty-prints t to a string.