Module Core_kernel.Option

This module extends Base.Option with bin_io, quickcheck, and support for ppx_optional.

type 'a t = 'a Base.Option.t
include Bin_prot.Binable.S1 with type 'a t := 'a t
type 'a t
val bin_shape_t : Bin_prot.Shape.t -> Bin_prot.Shape.t
val bin_size_t : ('a'a t) Bin_prot.Size.sizer1
val bin_write_t : ('a'a t) Bin_prot.Write.writer1
val bin_read_t : ('a'a t) Bin_prot.Read.reader1
val __bin_read_t__ : ('a, int -> 'a t) Bin_prot.Read.reader1
val bin_writer_t : ('a'a t) Bin_prot.Type_class.S1.writer
val bin_reader_t : ('a'a t) Bin_prot.Type_class.S1.reader
val bin_t : ('a'a t) Bin_prot.Type_class.S1.t
include Typerep_lib.Typerepable.S1 with type 'a t := 'a t
type 'a t
val typerep_of_t : 'a Typerep_lib.Std_internal.Typerep.t -> 'a t Typerep_lib.Std_internal.Typerep.t
val typename_of_t : 'a Typerep_lib.Typename.t -> 'a t Typerep_lib.Typename.t
include module type of sig ... end with type 'a t := 'a option
type 'a t = 'a option =
| None
| Some of 'a
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val hash_fold_t : (Base.Hash.state -> 'a -> Base.Hash.state) -> Base.Hash.state -> 'a t -> Base.Hash.state
val t_of_sexp : (Base.Sexp.t -> 'a) -> Base.Sexp.t -> 'a t
val sexp_of_t : ('a -> Base.Sexp.t) -> 'a t -> Base.Sexp.t
val mem : 'a t -> 'a -> equal:('a -> 'a -> bool) -> bool
val length : 'a t -> int
val is_empty : 'a t -> bool
val iter : 'a t -> f:('a -> unit) -> unit
val fold : 'a t -> init:'accum -> f:('accum -> 'a -> 'accum) -> 'accum
val fold_result : 'a t -> init:'accum -> f:('accum -> 'a -> ('accum'e) Base.Result.t) -> ('accum'e) Base.Result.t
val fold_until : 'a t -> init:'accum -> f:('accum -> 'a -> ('accum'final) Base__.Container_intf.Continue_or_stop.t) -> finish:('accum -> 'final) -> 'final
val exists : 'a t -> f:('a -> bool) -> bool
val for_all : 'a t -> f:('a -> bool) -> bool
val count : 'a t -> f:('a -> bool) -> int
val sum : (module Base__.Container_intf.Summable with type t = 'sum) -> 'a t -> f:('a -> 'sum) -> 'sum
val find : 'a t -> f:('a -> bool) -> 'a option
val find_map : 'a t -> f:('a -> 'b option) -> 'b option
val to_list : 'a t -> 'a list
val to_array : 'a t -> 'a array
val min_elt : 'a t -> compare:('a -> 'a -> int) -> 'a option
val max_elt : 'a t -> compare:('a -> 'a -> int) -> 'a option
val equal : 'a Base.Equal.equal -> 'a t Base.Equal.equal
val invariant : 'a Base__.Invariant_intf.inv -> 'a t Base__.Invariant_intf.inv
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val (>>|) : 'a t -> ('a -> 'b) -> 'b t
val bind : 'a t -> f:('a -> 'b t) -> 'b t
val return : 'a -> 'a t
val map : 'a t -> f:('a -> 'b) -> 'b t
val join : 'a t t -> 'a t
val ignore_m : 'a t -> unit t
val all : 'a t list -> 'a list t
val all_unit : unit t list -> unit t
val is_none : 'a t -> bool
val is_some : 'a t -> bool
val value_map : 'a t -> default:'b -> f:('a -> 'b) -> 'b
val map2 : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c t
val call : 'a -> f:('a -> unit) t -> unit
val value : 'a t -> default:'a -> 'a
val value_exn : ?⁠here:Base__.Source_code_position0.t -> ?⁠error:Base.Error.t -> ?⁠message:string -> 'a t -> 'a
val some : 'a -> 'a t
val both : 'a t -> 'b t -> ('a * 'b) t
val first_some : 'a t -> 'a t -> 'a t
val some_if : bool -> 'a -> 'a t
val merge : 'a t -> 'a t -> f:('a -> 'a -> 'a) -> 'a t
val filter : 'a t -> f:('a -> bool) -> 'a t
val try_with : (unit -> 'a) -> 'a t
val validate : none:unit Base.Validate.check -> some:'a Base.Validate.check -> 'a t Base.Validate.check
include Comparator.Derived with type 'a t := 'a t
type 'a t
type 'cmp comparator_witness
val comparator : ('a'cmp) Comparator.comparator -> ('a t'cmp comparator_witness) Comparator.comparator
include Quickcheckable.S1 with type 'a t := 'a t
type 'a t
val quickcheck_generator : 'a Base_quickcheck.Generator.t -> 'a t Base_quickcheck.Generator.t
val quickcheck_observer : 'a Base_quickcheck.Observer.t -> 'a t Base_quickcheck.Observer.t
val quickcheck_shrinker : 'a Base_quickcheck.Shrinker.t -> 'a t Base_quickcheck.Shrinker.t
module Stable : sig ... end
module Optional_syntax : Optional_syntax.S1 with type 'a t := 'a t and type 'a value := 'a

Optional_syntax allows Option.ts in the same matched expression as other types using Optional_syntax.