type ('a, 'b) t = ('a, 'b) Base.Result.t =| Ok of 'a| Error of 'b
include Bin_prot.Binable.S2 with type ('a, 'b) t := ('a, 'b) t
val bin_shape_t : Bin_prot.Shape.t -> Bin_prot.Shape.t -> Bin_prot.Shape.tval bin_size_t : ('a, 'b, ('a, 'b) t) Bin_prot.Size.sizer2val bin_write_t : ('a, 'b, ('a, 'b) t) Bin_prot.Write.writer2val bin_read_t : ('a, 'b, ('a, 'b) t) Bin_prot.Read.reader2val __bin_read_t__ : ('a, 'b, int -> ('a, 'b) t) Bin_prot.Read.reader2val bin_writer_t : ('a, 'b, ('a, 'b) t) Bin_prot.Type_class.S2.writerval bin_reader_t : ('a, 'b, ('a, 'b) t) Bin_prot.Type_class.S2.readerval bin_t : ('a, 'b, ('a, 'b) t) Bin_prot.Type_class.S2.t
val compare : ('a -> 'a -> Base.Int.t) -> ('b -> 'b -> Base.Int.t) -> ('a, 'b) t -> ('a, 'b) t -> Base.Int.tval equal : ('a -> 'a -> Base.Bool.t) -> ('b -> 'b -> Base.Bool.t) -> ('a, 'b) t -> ('a, 'b) t -> Base.Bool.tval hash_fold_t : (Base.Hash.state -> 'a -> Base.Hash.state) -> (Base.Hash.state -> 'b -> Base.Hash.state) -> Base.Hash.state -> ('a, 'b) t -> Base.Hash.state
include Ppx_sexp_conv_lib.Sexpable.S2 with type ('a, 'b) t := ('a, 'b) t
val t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> (Sexplib0.Sexp.t -> 'b) -> Sexplib0.Sexp.t -> ('a, 'b) tval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> ('b -> Sexplib0.Sexp.t) -> ('a, 'b) t -> Sexplib0.Sexp.t
include module type of Base.Result with type ('a, 'b) t := ('a, 'b) t
include Base.Sexpable.S2 with type ('ok, 'err) t := ('a, 'b) t
val t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> (Sexplib0.Sexp.t -> 'b) -> Sexplib0.Sexp.t -> ('a, 'b) tval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> ('b -> Sexplib0.Sexp.t) -> ('a, 'b) t -> Sexplib0.Sexp.t
val compare : ('ok -> 'ok -> int) -> ('err -> 'err -> int) -> ('a, 'b) t -> ('a, 'b) t -> intval equal : ('ok -> 'ok -> bool) -> ('err -> 'err -> bool) -> ('a, 'b) t -> ('a, 'b) t -> boolval hash_fold_t : (Base.Hash.state -> 'ok -> Base.Hash.state) -> (Base.Hash.state -> 'err -> Base.Hash.state) -> Base.Hash.state -> ('a, 'b) t -> Base.Hash.state
include Base.Monad.S2 with type ('a, 'err) t := ('a, 'b) t
module Let_syntax : sig ... endmodule Monad_infix : sig ... endval invariant : ('a -> unit) -> ('b -> unit) -> ('a, 'b) t -> unit
val fail : 'err -> ('a, 'b) tval failf : ('a, unit, string, ('a, 'b) t) Stdlib.format4 -> 'ae.g.,
failf "Couldn't find bloogle %s" (Bloogle.to_string b).
val is_ok : ('a, 'b) t -> boolval is_error : ('a, 'b) t -> boolval ok : ('a, 'b) t -> 'ok optionval ok_exn : ('a, 'b) t -> 'okval ok_or_failwith : ('a, 'b) t -> 'okval error : ('a, 'b) t -> 'err optionval of_option : 'ok option -> error:'err -> ('a, 'b) tval iter : ('a, 'b) t -> f:('ok -> unit) -> unitval iter_error : ('a, 'b) t -> f:('err -> unit) -> unitval map : ('a, 'b) t -> f:('ok -> 'c) -> ('a, 'b) tval map_error : ('a, 'b) t -> f:('err -> 'c) -> ('a, 'b) tval combine : ('a, 'b) t -> ('a, 'b) t -> ok:('ok1 -> 'ok2 -> 'ok3) -> err:('err -> 'err -> 'err) -> ('a, 'b) tReturns
Okif both areOkandErrorotherwise.
val combine_errors : ('a, 'b) t list -> ('a, 'b) tcombine_errors tsreturnsOkif every element intsisOk, else it returnsErrorwith all the errors ints.This is similar to
allfromMonad.S2, with the difference thatallonly returns the first error.
val combine_errors_unit : ('a, 'b) t list -> ('a, 'b) tcombine_errors_unitreturnsOkif every element intsisOk (), else it returnsErrorwith all the errors ints, likecombine_errors.
val to_either : ('a, 'b) t -> ('ok, 'err) Base__Either0.tto_eitheris useful withList.partition_map. For example:let ints, exns = List.partition_map ["1"; "two"; "three"; "4"] ~f:(fun string -> Result.to_either (Result.try_with (fun () -> Int.of_string string)))
val of_either : ('ok, 'err) Base__Either0.t -> ('a, 'b) tval ok_fst : ('a, 'b) t -> ('ok, 'err) Base__Either0.tval ok_if_true : bool -> error:'err -> ('a, 'b) tok_if_truereturnsOk ()ifboolis true, andError errorif it is false.
val try_with : (unit -> 'a) -> ('a, 'b) t
module Export : sig ... endmodule Stable : sig ... end