package octez-proto-libs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c6df840ebbf115e454db949028c595bec558a59a66cade73b52a6d099d6fa4d4
sha512=d8aee903b9fe130d73176bc8ec38b78c9ff65317da3cb4f3415f09af0c625b4384e7498201fdb61aa39086a7d5d409d0ab3423f9bc3ab989a680cf444a79bc13
doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V5/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.