Module Caml.Option
Options
type 'a t= 'a option=|None|Some of 'aThe type for option values. Either
Noneor a valueSome v.
val value : 'a option -> default:'a -> 'avalue o ~defaultisvifoisSome vanddefaultotherwise.
val bind : 'a option -> ('a -> 'b option) -> 'b optionbind o fisf vifoisSome vandNoneifoisNone.
val join : 'a option option -> 'a optionjoin ooisSome vifooisSome (Some v)andNoneotherwise.
val map : ('a -> 'b) -> 'a option -> 'b optionmap f oisNoneifoisNoneandSome (f v)isoisSome v.
Predicates and comparisons
Converting
val to_result : none:'e -> 'a option -> ('a, 'e) Stdlib.resultto_result ~none oisOk vifoisSome vandError noneotherwise.
val to_seq : 'a option -> 'a Seq.tto_seq oisoas a sequence.Noneis the empty sequence andSome vis the singleton sequence containingv.