package tablecloth-native

  1. Overview
  2. Docs
type 'a t = 'a option
val some : 'a -> 'a option
val andThen : f:('a -> 'b option) -> 'a option -> 'b option
val and_then : f:('a -> 'b option) -> 'a option -> 'b option
val or_ : 'a option -> 'a option -> 'a option
val orElse : 'a option -> 'a option -> 'a option
val or_else : 'a option -> 'a option -> 'a option
val map : f:('a -> 'b) -> 'a option -> 'b option
val withDefault : default:'a -> 'a option -> 'a
val with_default : default:'a -> 'a option -> 'a
val values : 'a option list -> 'a list
val toList : 'a option -> 'a list
val to_list : 'a option -> 'a list
val isSome : 'a option -> bool
val is_some : 'a option -> bool
val toOption : sentinel:'a -> 'a -> 'a option
val to_option : sentinel:'a -> 'a -> 'a option
val getExn : 'a option -> 'a
val get_exn : 'a option -> 'a

get_exn optional_value Returns value if optional_value is Some value, otherwise raises Invalid_argument

get_exn (Some 3) = 3;;
get_exn None (* Raises Invalid_argument error *)
OCaml

Innovation. Community. Security.