package octez-proto-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a
doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V11/Make/Option/index.html
Module Make.Option
Source
Signature from Lwtreslib's option module
val none_e : ('a option, 'trace) Pervasives.result
val none_s : 'a option Lwt.t
val none_es : ('a option, 'trace) Pervasives.result Lwt.t
val some_e : 'a -> ('a option, 'trace) Pervasives.result
val some_s : 'a -> 'a option Lwt.t
val some_es : 'a -> ('a option, 'trace) Pervasives.result Lwt.t
val value_e : 'a option -> error:'trace -> ('a, 'trace) Pervasives.result
val value_fe :
'a option ->
error:(unit -> 'trace) ->
('a, 'trace) Pervasives.result
val map_e :
('a -> ('b, 'trace) Pervasives.result) ->
'a option ->
('b option, 'trace) Pervasives.result
val map_es :
('a -> ('b, 'trace) Pervasives.result Lwt.t) ->
'a option ->
('b option, 'trace) Pervasives.result Lwt.t
val iter_e :
('a -> (unit, 'trace) Pervasives.result) ->
'a option ->
(unit, 'trace) Pervasives.result
val iter_es :
('a -> (unit, 'trace) Pervasives.result Lwt.t) ->
'a option ->
(unit, 'trace) Pervasives.result Lwt.t
val to_result : none:'trace -> 'a option -> ('a, 'trace) Pervasives.result
val of_result : ('a, 'e) Pervasives.result -> 'a option
val to_seq : 'a option -> 'a Seq.t
catch f
is Some (f ())
if f
does not raise an exception, it is None
otherwise.
You should only use catch
when you truly do not care about what exception may be raised during the evaluation of f ()
. If you need to inspect the raised exception, or if you need to pass it along, consider Result.catch
instead.
If catch_only
is set, then only exceptions e
such that catch_only e
is true
are caught.
Whether catch_only
is set or not, you cannot catch non-deterministic runtime exceptions of OCaml such as Stack_overflow
and Out_of_memory
nor system exceptions such as Unix.Unix_error
.
catch_s f
is a promise that resolves to Some x
if and when f ()
resolves to x
. Alternatively, it resolves to None
if and when f ()
is rejected.
You should only use catch_s
when you truly do not care about what exception may be raised during the evaluation of f ()
. If you need to inspect the raised exception, or if you need to pass it along, consider Result.catch_s
instead.
If catch_only
is set, then only exceptions e
such that catch_only e
is true
are caught.
Whether catch_only
is set or not, you cannot catch non-deterministic runtime exceptions of OCaml such as Stack_overflow
and Out_of_memory
nor system exceptions such as Unix.Unix_error
.