Module Core_kernel.Maybe_bound

This module extends the Base Maybe_bound module with compare functions in the form of As_lower_bound and As_upper_bound modules.

include module type of sig ... end
type 'a t = 'a Base__Maybe_bound.t =
| Incl of 'a
| Excl of 'a
| Unbounded
val t_of_sexp : (Base__.Sexplib.Sexp.t ‑> 'a) ‑> Base__.Sexplib.Sexp.t ‑> 'a t
val sexp_of_t : ('a ‑> Base__.Sexplib.Sexp.t) ‑> 'a t ‑> Base__.Sexplib.Sexp.t
val all : 'a list ‑> 'a t list
val map : 'a t ‑> f:('a ‑> 'b) ‑> 'b t
val is_lower_bound : 'a t ‑> of_:'a ‑> compare:('a ‑> 'a ‑> int) ‑> bool
val is_upper_bound : 'a t ‑> of_:'a ‑> compare:('a ‑> 'a ‑> int) ‑> bool
val interval_contains_exn : lower:'a t ‑> upper:'a t ‑> 'a ‑> compare:('a ‑> 'a ‑> int) ‑> bool
val bounds_crossed : lower:'a t ‑> upper:'a t ‑> compare:('a ‑> 'a ‑> int) ‑> bool
type interval_comparison = Base__Maybe_bound.interval_comparison =
| Below_lower_bound
| In_range
| Above_upper_bound
val compare_interval_comparison : interval_comparison ‑> interval_comparison ‑> int
val interval_comparison_of_sexp : Base__.Sexplib.Sexp.t ‑> interval_comparison
val sexp_of_interval_comparison : interval_comparison ‑> Base__.Sexplib.Sexp.t
val compare_to_interval_exn : lower:'a t ‑> upper:'a t ‑> 'a ‑> compare:('a ‑> 'a ‑> int) ‑> interval_comparison
module As_lower_bound : sig ... end

Compares t values as lower bounds, where Unbounded is lowest, Incl x < Excl x, and other cases of Incl and/or Excl are compared based on 'a. If As_lower_bound.compare compare t1 t2 <= 0 and is_lower_bound t2 ~of_:a ~compare, then is_lower_bound t1 ~of_:a ~compare. For example, for int As_lower_bound.t:

module As_upper_bound : sig ... end

Compares t values as upper bounds, where Unbounded is highest, Incl x > Excl x, and other cases of Incl and/or Excl are compared based on 'a. If As_upper_bound.compare compare_a t1 t2 <= 0 and is_upper_bound t1 ~of_:a ~compare, then is_upper_bound t2 ~of_:a ~compare. For example, for int As_upper_bound.t: