Up

Module Maybe_bound

Signature

type 'a t =
| Incl of 'a
| Excl of 'a
| Unbounded

Used for specifying a bound (either upper or lower) as inclusive, exclusive, or unbounded.

val t_of_sexp : (Sexplib.Sexp.t -> 'a) -> Sexplib.Sexp.t -> 'a t
val sexp_of_t : ('a -> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
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

interval_contains_exn ~lower ~upper x ~compare raises if lower and upper are crossed.

type interval_comparison =
| Below_lower_bound
| In_range
| Above_upper_bound
val compare_interval_comparison : interval_comparison -> interval_comparison -> int
val interval_comparison_of_sexp : Sexplib.Sexp.t -> interval_comparison
val sexp_of_interval_comparison : interval_comparison -> Sexplib.Sexp.t
val compare_to_interval_exn : lower:'a t -> upper:'a t -> 'a -> compare:('a -> 'a -> int) -> interval_comparison

compare_to_interval_exn ~lower ~upper x ~compare raises if lower and upper are crossed.