Kxclib.Option
include module type of Stdlib.Option
module Ops : sig ... end
val get : 'a t -> 'a
val v : 'a -> 'a t -> 'a
val v' : (unit -> 'a) -> 'a t -> 'a
val or_raise : exn -> 'a t -> 'a
val pp :
(Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter ->
'a t ->
unit
val of_bool : bool -> unit t
val some_if : bool -> 'a -> 'a t
protect ~capture f x
returns Some (f x)
except when
f x
throws an exn
s.t. capture exn = true
, it returns None
f x
throws an exn
s.t. capture exn = false
, it rethrows exn
~capture
defaults to fun _exn -> true
try_make ~capture f
is protect ~capture f ()
, thus see protect
~capture
defaults to fun _exn -> true