package n_ary

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

Defines an enumeration type with 3 constructors. We refer to each constructor as a "case". Cases and their respective int values are numbered consecutively starting at zero.

type t =
  1. | Case0
  2. | Case1
  3. | Case2
include Ppx_compare_lib.Comparable.S with type t := t
val compare : t -> t -> int
include Ppx_enumerate_lib.Enumerable.S with type t := t
val all : t list
include Ppx_compare_lib.Equal.S with type t := t
val equal : t -> t -> bool
include Ppx_hash_lib.Hashable.S with type t := t
val hash_fold_t : Base.Hash.state -> t -> Base.Hash.state
val hash : t -> Base.Hash.hash_value
val sexp_of_t : t -> Sexplib0.Sexp.t

Constants *

val case0 : t
val case1 : t
val case2 : t

Predicates

val is_case0 : t -> Base.bool
val is_case1 : t -> Base.bool
val is_case2 : t -> Base.bool

Conversions to and from int *

val to_int : t -> Base.int
val of_int : Base.int -> t Base.option
val of_int_exn : Base.int -> t
OCaml

Innovation. Community. Security.