Module Core.NothingSource
This module extends Base.Nothing.
type t = Base.Nothing.t = |Having [@@deriving enumerate] may seem strange due to the fact that generated val all : t list is the empty list, so it seems like it could be of no use.
This may be true if you always expect your type to be Nothing.t, but [@@deriving enumerate] can be useful if you have a type which you expect to change over time. For example, you may have a program which has to interact with multiple servers which are possibly at different versions. It may be useful in this program to have a variant type which enumerates the ways in which the servers may differ. When all the servers are at the same version, you can change this type to Nothing.t and code which uses an enumeration of the type will continue to work correctly.
This is a similar issue to the identifiability of Nothing.t. As discussed below, another case where [@deriving enumerate] could be useful is when this type is part of some larger type.
Similar arguments apply for other derivers, like globalize and sexp_grammar.
include Ppx_enumerate_lib.Enumerable.S with type t := Core.Nothing.t
val all : Core.Nothing.t listval globalize : Core.Nothing.t @ local -> Core.Nothing.tinclude Sexplib0.Sexpable.S__stack with type t := Core.Nothing.t
val sexp_of_t__stack : Core.Nothing.t @ local -> Sexplib0.Sexp.t @ localval t_sexp_grammar : Core.Nothing.t Sexplib0.Sexp_grammar.t @@ portableval unreachable_code : Core.Nothing.t -> _ @@ portableBecause there are no values of type Nothing.t, a piece of code that has a value of type Nothing.t must be unreachable. In such an unreachable piece of code, one can use unreachable_code to give the code whatever type one needs. For example:
let f (r : (int, Nothing.t) Result.t) : int =
match r with
| Ok i -> i
| Error n -> Nothing.unreachable_code n
;;Note that the compiler knows that Nothing.t is uninhabited, hence this will type without warning:
let f (Ok i : (int, Nothing.t) Result.t) = ival unreachable_code_local : Core.Nothing.t @ local -> _ @@ portableThe same as unreachable_code, but for local ts.
It may seem weird that this is identifiable, but we're just trying to anticipate all the contexts in which people may need this. It would be a crying shame if you had some variant type involving Nothing.t that you wished to make identifiable, but were prevented for lack of Identifiable.S here.
Obviously, of_string and t_of_sexp will raise an exception.
include Base.Identifiable.S__local__portable with type t := Core.Nothing.t
type comparator_witness = Base.Nothing.comparator_witnessval must_be_none : Core.Nothing.t option -> unit @@ portableIgnores None and guarantees there is no Some _. A better replacement for ignore.
val must_be_empty : Core.Nothing.t list -> unit @@ portableIgnores [] and guarantees there is no _ :: _. A better replacement for ignore.
val must_be_ok : ('ok, Core.Nothing.t) Base.Result.t -> 'ok @@ portableReturns ok from Ok ok and guarantees there is no Error _.
val must_be_error : (Core.Nothing.t, 'err) Base.Result.t -> 'err @@ portableReturns err from Error err and guarantees there is no Ok _.
val must_be_first : ('fst, Core.Nothing.t) Base.Either.t -> 'fst @@ portableReturns fst from First fst and guarantees there is no Second _.
val must_be_second : (Core.Nothing.t, 'snd) Base.Either.t -> 'snd @@ portableReturns snd from Second snd and guarantees there is no First _.
It may seem weird that this is identifiable, but we're just trying to anticipate all the contexts in which people may need this. It would be a crying shame if you had some variant type involving Nothing.t that you wished to make identifiable, but were prevented for lack of Identifiable.S here.
Obviously, of_string and t_of_sexp will raise an exception.
include Core.Identifiable.S__local
with type t := Core.Nothing.t
and type comparator_witness := Core.Nothing.comparator_witness
val bin_size_t : Core.Nothing.t Bin_prot.Size.sizerval bin_write_t : Core.Nothing.t Bin_prot.Write.writerval bin_size_t__local : Core.Nothing.t Bin_prot.Size.sizer__localval bin_write_t__local : Core.Nothing.t Bin_prot.Write.writer__localval bin_read_t : Core.Nothing.t Bin_prot.Read.readerval __bin_read_t__ : Core.Nothing.t Bin_prot.Read.vtag_readerval bin_shape_t : Bin_prot.Shape.tval bin_writer_t : Core.Nothing.t Bin_prot.Type_class.writerval bin_reader_t : Core.Nothing.t Bin_prot.Type_class.readerval bin_t : Core.Nothing.t Bin_prot.Type_class.tval t_of_sexp : Sexplib0.Sexp.t -> Core.Nothing.tval sexp_of_t : Core.Nothing.t -> Sexplib0.Sexp.tval of_string : string -> Core.Nothing.tval to_string : Core.Nothing.t -> stringval pp : Base.Formatter.t -> Core.Nothing.t -> unitval (>=) : Core.Nothing.t -> Core.Nothing.t -> boolval (<=) : Core.Nothing.t -> Core.Nothing.t -> boolval (=) : Core.Nothing.t -> Core.Nothing.t -> boolval (>) : Core.Nothing.t -> Core.Nothing.t -> boolval (<) : Core.Nothing.t -> Core.Nothing.t -> boolval (<>) : Core.Nothing.t -> Core.Nothing.t -> boolval equal : Core.Nothing.t -> Core.Nothing.t -> boolval compare : Core.Nothing.t -> Core.Nothing.t -> intval equal__local : Core.Nothing.t @ local -> Core.Nothing.t @ local -> boolval compare__local : Core.Nothing.t @ local -> Core.Nothing.t @ local -> intval min : Core.Nothing.t -> Core.Nothing.t -> Core.Nothing.tval max : Core.Nothing.t -> Core.Nothing.t -> Core.Nothing.tval ascending : Core.Nothing.t -> Core.Nothing.t -> intval descending : Core.Nothing.t -> Core.Nothing.t -> intval between :
Core.Nothing.t ->
low:Core.Nothing.t ->
high:Core.Nothing.t ->
boolval clamp_exn :
Core.Nothing.t ->
min:Core.Nothing.t ->
max:Core.Nothing.t ->
Core.Nothing.tval clamp :
Core.Nothing.t ->
min:Core.Nothing.t ->
max:Core.Nothing.t ->
Core.Nothing.t Base.Or_error.tval validate_lbound :
min:Core.Nothing.t Core.Maybe_bound.t ->
Core.Nothing.t Validate.checkval validate_ubound :
max:Core.Nothing.t Core.Maybe_bound.t ->
Core.Nothing.t Validate.checkval validate_bound :
min:Core.Nothing.t Core.Maybe_bound.t ->
max:Core.Nothing.t Core.Maybe_bound.t ->
Core.Nothing.t Validate.checkval comparator :
(Core.Nothing.t, Core.Nothing.comparator_witness)
Base.Comparator.T.comparatorval hash_fold_t : Core.Nothing.t Ppx_hash_lib.hash_foldval hash : Core.Nothing.t -> Ppx_hash_lib.Std.Hash.hash_valueval hashable : Core.Nothing.t Base.Hashable.t