Results
Standard Library
This module contains everything defined for lists by the OCaml standard library. For these functions, refer to the official documentation.
include module type of Stdlib.Result
type (!'a, !'e) t = ('a, 'e) Stdlib.result = | Ok of 'a| Error of 'e
val ok : 'a -> ('a, 'e) Stdlib.resultval error : 'e -> ('a, 'e) Stdlib.resultval value : ('a, 'e) Stdlib.result -> default:'a -> 'aval get_ok : ('a, 'e) Stdlib.result -> 'aval get_error : ('a, 'e) Stdlib.result -> 'eval bind :
('a, 'e) Stdlib.result ->
('a -> ('b, 'e) Stdlib.result) ->
('b, 'e) Stdlib.resultval join : (('a, 'e) Stdlib.result, 'e) Stdlib.result -> ('a, 'e) Stdlib.resultval map : ('a -> 'b) -> ('a, 'e) Stdlib.result -> ('b, 'e) Stdlib.resultval map_error : ('e -> 'f) -> ('a, 'e) Stdlib.result -> ('a, 'f) Stdlib.resultval fold : ok:('a -> 'c) -> error:('e -> 'c) -> ('a, 'e) Stdlib.result -> 'cval iter : ('a -> unit) -> ('a, 'e) Stdlib.result -> unitval iter_error : ('e -> unit) -> ('a, 'e) Stdlib.result -> unitval is_ok : ('a, 'e) Stdlib.result -> boolval is_error : ('a, 'e) Stdlib.result -> boolval equal :
ok:('a -> 'a -> bool) ->
error:('e -> 'e -> bool) ->
('a, 'e) Stdlib.result ->
('a, 'e) Stdlib.result ->
boolval compare :
ok:('a -> 'a -> int) ->
error:('e -> 'e -> int) ->
('a, 'e) Stdlib.result ->
('a, 'e) Stdlib.result ->
intval to_option : ('a, 'e) Stdlib.result -> 'a optionval to_list : ('a, 'e) Stdlib.result -> 'a listval to_seq : ('a, 'e) Stdlib.result -> 'a Stdlib.Seq.tAdditional Contents
val of_string_nonempty :
empty:string ->
string ->
(string, string) Stdlib.resultMaps "" to Error empty and other strings to Ok.
val map_both :
ok:('a -> 'b) ->
error:('e -> 'f) ->
('a, 'e) Stdlib.result ->
('b, 'f) Stdlib.result