Module Option

module Option: sig .. end
No "J" prefix for this module since OCaml's standard library does not have an Option module.

val map : ('a -> 'b) -> 'a option -> 'b option
map f opt maps None to None and Some a to Some (f a)
val map_none : 'a -> 'a option -> 'a
map_none n opt maps None to n and Some m to m.
val unit_bool : unit option -> bool
Since unit option and bool are isomorphic, this function implements the morphism from unit option to bool. None maps to false and Some () to true.
val extract : 'a option -> 'a
When you're sure you have Some
val iter : ('a -> unit) -> 'a option -> unit
The name speaks for itself
val bind : 'a option -> ('a -> 'b option) -> 'b option
Maps None to None and Some x to f x.
val is_some : 'a option -> bool
val flatten : 'a option option -> 'a option
val to_list : 'a option -> 'a list