Stdlib320.Resultval value : ('a, 'e) result -> default:'a -> 'aGets the value of result if it is not an error. value r ~default:y is
x if r = Ok xy if r = Error eval default : 'a -> ('a, 'e) result -> 'aA slightly more useful variant of value, where default y r is equivalent to value r ~default:y
val is_ok : ('a, 'e) result -> boolis_ok r is
true if r = Ok xfalse if r = Error eval is_error : ('a, 'e) result -> boolis_error r is equivalent to not (is_ok e)
Monadic bind for results. It "does something" to the value of a result if it is not an error, and passes along the error otherwise. bind r f is
f x if r = Ok xError e if r = Error eMonadic join for results. It collapses a result whose value is result into a single result. join rr is
Ok x if rr = Ok (Ok x)Error e1 if rr = Error e1Error e2 if rr = Ok (Error e2)Mapping function for result values. It applies a function to the value of the result if the result is not an error and passes along the error otherwise. map f r is
Ok (f x) if r = Ok xError e if r = Error eMapping function for result errors. Similar to the previous function but on errors. map f r is
Ok x if r = Ok xError (f e) if r = Error eval fold : ok:('a -> 'c) -> error:('e -> 'c) -> ('a, 'e) result -> 'cFolding function for results. Similar to the folding for options. fold ~ok:f ~error:g r is
f x if r = Ok xg e if r = Error eval to_option : ('a, 'e) result -> 'a optionConverts a result into an option, dropping the error information. to_option r is
Some x if r = Ok xNone if r = Error eval to_list : ('a, 'e) result -> 'a listto_list r is equivalent to Option.to_list (to_option r)