package core_kernel

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

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
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
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 struct include Base.Option end with type 'a t := 'a option
val compare : ('a -> 'a -> int) -> 'a option -> 'a option -> int
val hash_fold_t : (Base__.Ppx_hash_lib.Std.Hash.state -> 'a -> Base__.Ppx_hash_lib.Std.Hash.state) -> Base__.Ppx_hash_lib.Std.Hash.state -> 'a option -> Base__.Ppx_hash_lib.Std.Hash.state
val t_of_sexp : (Sexplib0__.Sexp.t -> 'a) -> Sexplib0__.Sexp.t -> 'a option
val sexp_of_t : ('a -> Sexplib0__.Sexp.t) -> 'a option -> Sexplib0__.Sexp.t
val t_sexp_grammar : Base__.Ppx_sexp_conv_lib.Sexp.Private.Raw_grammar.t
val mem : 'a option -> 'a -> equal:('a -> 'a -> bool) -> bool
val length : 'a option -> int
val is_empty : 'a option -> bool
val iter : 'a option -> f:('a -> unit) -> unit
val fold : 'a option -> init:'accum -> f:('accum -> 'a -> 'accum) -> 'accum
val fold_result : 'a option -> init:'accum -> f:('accum -> 'a -> ('accum, 'e) Base__.Result.t) -> ('accum, 'e) Base__.Result.t
val fold_until : 'a option -> init:'accum -> f:('accum -> 'a -> ('accum, 'final) Base__Container_intf.Continue_or_stop.t) -> finish:('accum -> 'final) -> 'final
val exists : 'a option -> f:('a -> bool) -> bool
val for_all : 'a option -> f:('a -> bool) -> bool
val count : 'a option -> f:('a -> bool) -> int
val sum : (module Base__Container_intf.Summable with type t = 'sum) -> 'a option -> f:('a -> 'sum) -> 'sum
val find : 'a option -> f:('a -> bool) -> 'a option
val find_map : 'a option -> f:('a -> 'b option) -> 'b option
val to_list : 'a option -> 'a list
val to_array : 'a option -> 'a array
val min_elt : 'a option -> compare:('a -> 'a -> int) -> 'a option
val max_elt : 'a option -> compare:('a -> 'a -> int) -> 'a option
val equal : 'a Base__Equal.equal -> 'a option Base__Equal.equal
val invariant : 'a Base__Invariant_intf.inv -> 'a option Base__Invariant_intf.inv
val (>>=) : 'a option -> ('a -> 'b option) -> 'b option
val (>>|) : 'a option -> ('a -> 'b) -> 'b option
module Monad_infix : sig ... end
val bind : 'a option -> f:('a -> 'b option) -> 'b option
val return : 'a -> 'a option
val map : 'a option -> f:('a -> 'b) -> 'b option
val join : 'a option option -> 'a option
val ignore_m : 'a option -> unit option
val all : 'a option list -> 'a list option
val all_unit : unit option list -> unit option
module Let_syntax : sig ... end
val is_none : 'a option -> bool
val is_some : 'a option -> bool
val value_map : 'a option -> default:'b -> f:('a -> 'b) -> 'b
val map2 : 'a option -> 'b option -> f:('a -> 'b -> 'c) -> 'c option
val call : 'a -> f:('a -> unit) option -> unit
val value : 'a option -> default:'a -> 'a
val value_exn : ?here:Base__.Source_code_position0.t -> ?error:Base__.Error.t -> ?message:string -> 'a option -> 'a
val some : 'a -> 'a option
val both : 'a option -> 'b option -> ('a * 'b) option
val first_some : 'a option -> 'a option -> 'a option
val some_if : bool -> 'a -> 'a option
val merge : 'a option -> 'a option -> f:('a -> 'a -> 'a) -> 'a option
val filter : 'a option -> f:('a -> bool) -> 'a option
val try_with : (unit -> 'a) -> 'a option
val try_with_join : (unit -> 'a option) -> 'a option
val validate : none:unit Base__.Validate.check -> some:'a Base__.Validate.check -> 'a option Base__.Validate.check
include Comparator.Derived with type 'a t := '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
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

You might think that it's pointless to have Optional_syntax on options because OCaml already has nice syntax for matching on options. The reason to have this here is that you might have, for example, a tuple of an option and some other type that supports Optional_syntax. Since Optional_syntax can only be opted into at the granularity of the whole match expression, we need this Optional_syntax support for options in order to use it for the other half of the tuple.

OCaml

Innovation. Community. Security.