package octez-proto-libs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V7/Make/Result/index.html
Module Make.ResultSource
val ok : 'a -> ('a, 'e) Pervasives.resultval ok_s : 'a -> ('a, 'e) Pervasives.result Lwt.tval error : 'e -> ('a, 'e) Pervasives.resultval error_s : 'e -> ('a, 'e) Pervasives.result Lwt.tval return : 'a -> ('a, 'e) Pervasives.resultval return_unit : (unit, 'e) Pervasives.resultval return_none : ('a option, 'e) Pervasives.resultval return_some : 'a -> ('a option, 'e) Pervasives.resultval return_nil : ('a list, 'e) Pervasives.resultval return_true : (bool, 'e) Pervasives.resultval return_false : (bool, 'e) Pervasives.resultval value : ('a, 'e) Pervasives.result -> default:'a -> 'aval value_f : ('a, 'e) Pervasives.result -> default:(unit -> 'a) -> 'aval bind :
('a, 'e) Pervasives.result ->
('a -> ('b, 'e) Pervasives.result) ->
('b, 'e) Pervasives.resultval bind_s :
('a, 'e) Pervasives.result ->
('a -> ('b, 'e) Pervasives.result Lwt.t) ->
('b, 'e) Pervasives.result Lwt.tval bind_error :
('a, 'e) Pervasives.result ->
('e -> ('a, 'f) Pervasives.result) ->
('a, 'f) Pervasives.resultval bind_error_s :
('a, 'e) Pervasives.result ->
('e -> ('a, 'f) Pervasives.result Lwt.t) ->
('a, 'f) Pervasives.result Lwt.tval join :
(('a, 'e) Pervasives.result, 'e) Pervasives.result ->
('a, 'e) Pervasives.resultval map :
('a -> 'b) ->
('a, 'e) Pervasives.result ->
('b, 'e) Pervasives.resultval map_e :
('a -> ('b, 'e) Pervasives.result) ->
('a, 'e) Pervasives.result ->
('b, 'e) Pervasives.resultval map_s :
('a -> 'b Lwt.t) ->
('a, 'e) Pervasives.result ->
('b, 'e) Pervasives.result Lwt.tval map_es :
('a -> ('b, 'e) Pervasives.result Lwt.t) ->
('a, 'e) Pervasives.result ->
('b, 'e) Pervasives.result Lwt.tval map_error :
('e -> 'f) ->
('a, 'e) Pervasives.result ->
('a, 'f) Pervasives.resultval map_error_e :
('e -> ('a, 'f) Pervasives.result) ->
('a, 'e) Pervasives.result ->
('a, 'f) Pervasives.resultval map_error_s :
('e -> 'f Lwt.t) ->
('a, 'e) Pervasives.result ->
('a, 'f) Pervasives.result Lwt.tval map_error_es :
('e -> ('a, 'f) Pervasives.result Lwt.t) ->
('a, 'e) Pervasives.result ->
('a, 'f) Pervasives.result Lwt.tval fold :
ok:('a -> 'c) ->
error:('e -> 'c) ->
('a, 'e) Pervasives.result ->
'cval iter : ('a -> unit) -> ('a, 'e) Pervasives.result -> unitval iter_s : ('a -> unit Lwt.t) -> ('a, 'e) Pervasives.result -> unit Lwt.tval iter_error : ('e -> unit) -> ('a, 'e) Pervasives.result -> unitval iter_error_s :
('e -> unit Lwt.t) ->
('a, 'e) Pervasives.result ->
unit Lwt.tval is_ok : ('a, 'e) Pervasives.result -> boolval is_error : ('a, 'e) Pervasives.result -> boolval equal :
ok:('a -> 'a -> bool) ->
error:('e -> 'e -> bool) ->
('a, 'e) Pervasives.result ->
('a, 'e) Pervasives.result ->
boolval compare :
ok:('a -> 'a -> int) ->
error:('e -> 'e -> int) ->
('a, 'e) Pervasives.result ->
('a, 'e) Pervasives.result ->
intval to_option : ('a, 'e) Pervasives.result -> 'a optionval of_option : error:'e -> 'a option -> ('a, 'e) Pervasives.resultval to_list : ('a, 'e) Pervasives.result -> 'a listval to_seq : ('a, 'e) Pervasives.result -> 'a Seq.tcatch f is try Ok (f ()) with e -> Error e: it is Ok x if f () evaluates to x, and it is Error e if f () raises e.
See WithExceptions.S.Result.to_exn for a converse function.
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.
val catch_f :
?catch_only:(exn -> bool) ->
(unit -> 'a) ->
(exn -> 'error) ->
('a, 'error) Pervasives.resultcatch_f f handler is equivalent to map_error (catch f) handler. In other words, it catches exceptions in f () and either returns the value in an Ok or passes the exception to handler for the Error.
catch_only has the same use as with catch. The same restriction on catching non-deterministic runtime exceptions applies.
val catch_s :
?catch_only:(exn -> bool) ->
(unit -> 'a Lwt.t) ->
('a, exn) Pervasives.result Lwt.tcatch_s is catch but for Lwt promises. Specifically, catch_s f returns a promise that resolves to Ok x if and when f () resolves to x, or to Error exc if and when f () is rejected with exc.
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.