You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
1.3 KiB
84 lines
1.3 KiB
6 years ago
|
(*
|
||
|
* Copyright (c) 2017-present, Facebook, Inc.
|
||
|
*
|
||
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
|
*)
|
||
|
|
||
|
open! IStd
|
||
|
module F = Format
|
||
|
|
||
|
module NonZeroInt : sig
|
||
|
type t = private int [@@deriving compare]
|
||
|
|
||
|
exception DivisionNotExact
|
||
|
|
||
|
val one : t
|
||
|
|
||
|
val minus_one : t
|
||
|
|
||
|
val of_int : int -> t option
|
||
|
|
||
|
val opt_to_int : t option -> int
|
||
|
|
||
|
val is_one : t -> bool
|
||
|
|
||
|
val is_minus_one : t -> bool
|
||
|
|
||
|
val is_multiple : int -> t -> bool
|
||
|
|
||
|
val is_negative : t -> bool
|
||
|
|
||
|
val is_positive : t -> bool
|
||
|
|
||
|
val ( ~- ) : t -> t
|
||
|
|
||
|
val ( * ) : t -> t -> t
|
||
|
|
||
|
val plus : t -> t -> t option
|
||
|
|
||
|
val exact_div_exn : t -> t -> t
|
||
|
|
||
|
val max : t -> t -> t
|
||
|
|
||
|
val min : t -> t -> t
|
||
|
end
|
||
|
|
||
|
module NonNegativeInt : sig
|
||
|
type t = private int [@@deriving compare]
|
||
|
|
||
|
val zero : t
|
||
|
|
||
|
val one : t
|
||
|
|
||
|
val of_int : int -> t option
|
||
|
|
||
|
val of_int_exn : int -> t
|
||
|
|
||
|
val is_zero : t -> bool
|
||
|
|
||
|
val is_one : t -> bool
|
||
|
|
||
|
val ( <= ) : lhs:t -> rhs:t -> bool
|
||
|
|
||
|
val ( + ) : t -> t -> t
|
||
|
|
||
|
val ( * ) : t -> t -> t
|
||
|
|
||
|
val max : t -> t -> t
|
||
|
|
||
|
val pp : F.formatter -> t -> unit
|
||
|
end
|
||
|
|
||
|
module PositiveInt : sig
|
||
|
type t = private NonNegativeInt.t [@@deriving compare]
|
||
|
|
||
|
val one : t
|
||
|
|
||
|
val of_int : int -> t option
|
||
|
|
||
|
val succ : t -> t
|
||
|
|
||
|
val pp : F.formatter -> t -> unit
|
||
|
end
|