package base

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

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

type 'a t =
  1. | Incl of 'a
  2. | Excl of 'a
  3. | Unbounded
val all : 'a list -> 'a t list
include Sexplib0.Sexpable.S1 with type 'a t := 'a t
val t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
val t_sexp_grammar : 'a Sexplib0.Sexp_grammar.t -> 'a t Sexplib0.Sexp_grammar.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.

val bounds_crossed : lower:'a t -> upper:'a t -> compare:('a -> 'a -> int) -> bool

bounds_crossed ~lower ~upper ~compare returns true if lower > upper.

It ignores whether the bounds are Incl or Excl.

type interval_comparison =
  1. | Below_lower_bound
  2. | In_range
  3. | Above_upper_bound
val sexp_of_interval_comparison : interval_comparison -> Sexplib0.Sexp.t
val interval_comparison_of_sexp : Sexplib0.Sexp.t -> interval_comparison
val interval_comparison_sexp_grammar : interval_comparison Sexplib0.Sexp_grammar.t
val compare_interval_comparison : interval_comparison -> interval_comparison -> int
val hash_fold_interval_comparison : Hash.state -> interval_comparison -> Hash.state
val hash_interval_comparison : interval_comparison -> Hash.hash_value
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.

OCaml

Innovation. Community. Security.