Module Js.Optdef
Standard functions for manipulating possibly undefined values.
type 'a t= 'a optdef
val empty : 'a tNo value.
val return : 'a -> 'a tConsider a value as an optional value.
val map : 'a t -> ('a -> 'b) -> 'b tApply a function to an optional value if it is available. Returns the result of the application.
val bind : 'a t -> ('a -> 'b t) -> 'b tApply a function returning an optional value to an optional value
val test : 'a t -> boolReturns
trueif a value is available,falseotherwise.
val iter : 'a t -> ('a -> unit) -> unitApply a function to an optional value if it is available.
val case : 'a t -> (unit -> 'b) -> ('a -> 'b) -> 'bPattern matching on optional values.
val get : 'a t -> (unit -> 'a) -> 'aGet the value. If no value available, an alternative function is called to get a default value.
val option : 'a option -> 'a tConvert option type.
val to_option : 'a t -> 'a optionConvert to option type.