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.tval 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.stateinclude 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.tinclude 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 : (Base.Sexp.t -> 'a) -> (Base.Sexp.t -> 'b) -> Base.Sexp.t -> ('a, 'b) tval sexp_of_t : ('a -> Base.Sexp.t) -> ('b -> Base.Sexp.t) -> ('a, 'b) t -> Base.Sexp.tval 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.stateinclude Base.Monad.S2 with type ('a, 'err) t := ('a, 'b) t
module Let_syntax : sig ... endmodule Monad_infix : sig ... endval return : 'a -> ('a, 'b) tval 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 combine : ('a, 'b) t -> ('a, 'b) t -> ok:('ok1 -> 'ok2 -> 'ok3) -> err:('err -> 'err -> 'err) -> ('a, 'b) tReturns Ok if both are Ok and Error otherwise.
combine_errors ts returns Ok if every element in ts is Ok, else it returns Error with all the errors in ts.
This is similar to all from Monad.S2, with the difference that all only returns the first error.
combine_errors_unit returns Ok if every element in ts is Ok (), else it returns Error with all the errors in ts, like combine_errors.
val ok_fst : ('a, 'b) t -> [ `Fst of 'ok | `Snd of 'err ]ok_fst is useful with List.partition_map. Continuing the above example:
let rics, errors = List.partition_map ~f:Result.ok_fst
(List.map ~f:ric_of_ticker ["AA"; "F"; "CSCO"; "AAPL"]) val ok_if_true : bool -> error:'err -> ('a, 'b) tok_if_true returns Ok () if bool is true, and Error error if it is false.
val try_with : (unit -> 'a) -> ('a, 'b) tval ok_unit : ('a, 'b) tok_unit = Ok (), used to avoid allocation as a performance hack.
module Export : sig ... endmodule Stable : sig ... end