package volgo
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=2714935a34417be2151736a4765431746c9348db5a3b4f0eaacaf74dfaefeabb
sha512=0eba27395125ae928fd53561029d9653094d822b2907cb9afc18f412b46ef47cf880ba80d1bf17212add4e68e6a55e2792176303e2b0bcee08940e25731b4738
doc/volgo.stdlib/Volgo_stdlib/Result/index.html
Module Volgo_stdlib.ResultSource
include module type of Result
Results
The type for result values. Either a value Ok v or an error Error e.
value r ~default is v if r is Ok v and default otherwise.
get_ok' is like get_ok but in case of error uses the error message for raising Invalid_argument.
error_to_failure r is v if r is Ok v and raises Failure e if r is Error e.
bind r f is f v if r is Ok v and r if r is Error _.
join rr is r if rr is Ok r and rr if rr is Error _.
product r0 r1 is Ok (v0, v1) if r0 is Ok v0 and r1 is Ok v2 and otherwise returns the error of r0, if any, or the error of r1.
fold ~ok ~error r is ok v if r is Ok v and error e if r is Error e.
iter f r is f v if r is Ok v and () otherwise.
iter_error f r is f e if r is Error e and () otherwise.
Predicates and comparisons
val equal :
ok:('a -> 'a -> bool) ->
error:('e -> 'e -> bool) ->
('a, 'e) result ->
('a, 'e) result ->
boolequal ~ok ~error r0 r1 tests equality of r0 and r1 using ok and error to respectively compare values wrapped by Ok _ and Error _.
val compare :
ok:('a -> 'a -> int) ->
error:('e -> 'e -> int) ->
('a, 'e) result ->
('a, 'e) result ->
intcompare ~ok ~error r0 r1 totally orders r0 and r1 using ok and error to respectively compare values wrapped by Ok _ and Error _. Ok _ values are smaller than Error _ values.
Converting
to_option r is r as an option, mapping Ok v to Some v and Error _ to None.
to_seq r is r as a sequence. Ok v is the singleton sequence containing v and Error _ is the empty sequence.
Syntax
val sexp_of_t :
('a -> Sexplib0.Sexp.t) ->
('b -> Sexplib0.Sexp.t) ->
('a, 'b) Result.t ->
Sexplib0.Sexp.t