sig
type ('a, 'b) result = ('a, 'b) result = Ok of 'a | Error of 'b
type 'a sequence = ('a -> unit) -> unit
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a printer = Format.formatter -> 'a -> unit
type ('good, 'bad) t =
('good, 'bad) Result.result =
Ok of 'good
| Error of 'bad
val return : 'a -> ('a, 'err) t
val fail : 'err -> ('a, 'err) t
val of_exn : exn -> ('a, string) t
val of_exn_trace : exn -> ('a, string) t
val fail_printf : ('a, Buffer.t, unit, ('b, string) t) format4 -> 'a
val fail_fprintf :
('a, Format.formatter, unit, ('b, string) t) format4 -> 'a
val add_ctx : string -> ('a, string) t -> ('a, string) t
val add_ctxf :
('a, Format.formatter, unit, ('b, string) t -> ('b, string) t) format4 ->
'a
val map : ('a -> 'b) -> ('a, 'err) t -> ('b, 'err) t
val map_err : ('err1 -> 'err2) -> ('a, 'err1) t -> ('a, 'err2) t
val map2 : ('a -> 'b) -> ('err1 -> 'err2) -> ('a, 'err1) t -> ('b, 'err2) t
val iter : ('a -> unit) -> ('a, 'b) t -> unit
exception Get_error
val get_exn : ('a, 'b) t -> 'a
val get_or : ('a, 'b) t -> default:'a -> 'a
val map_or : ('a -> 'b) -> ('a, 'c) t -> default:'b -> 'b
val catch : ('a, 'err) t -> ok:('a -> 'b) -> err:('err -> 'b) -> 'b
val flat_map : ('a -> ('b, 'err) t) -> ('a, 'err) t -> ('b, 'err) t
val ( >|= ) : ('a, 'err) t -> ('a -> 'b) -> ('b, 'err) t
val ( >>= ) : ('a, 'err) t -> ('a -> ('b, 'err) t) -> ('b, 'err) t
val equal : ?err:'err equal -> 'a equal -> ('a, 'err) t equal
val compare : ?err:'err ord -> 'a ord -> ('a, 'err) t ord
val fold : ok:('a -> 'b) -> error:('err -> 'b) -> ('a, 'err) t -> 'b
val fold_ok : ('a -> 'b -> 'a) -> 'a -> ('b, 'c) t -> 'a
val is_ok : ('a, 'err) t -> bool
val is_error : ('a, 'err) t -> bool
val guard : (unit -> 'a) -> ('a, exn) t
val guard_str : (unit -> 'a) -> ('a, string) t
val guard_str_trace : (unit -> 'a) -> ('a, string) t
val wrap1 : ('a -> 'b) -> 'a -> ('b, exn) t
val wrap2 : ('a -> 'b -> 'c) -> 'a -> 'b -> ('c, exn) t
val wrap3 : ('a -> 'b -> 'c -> 'd) -> 'a -> 'b -> 'c -> ('d, exn) t
val pure : 'a -> ('a, 'err) t
val ( <*> ) : ('a -> 'b, 'err) t -> ('a, 'err) t -> ('b, 'err) t
val join : (('a, 'err) t, 'err) t -> ('a, 'err) t
val both : ('a, 'err) t -> ('b, 'err) t -> ('a * 'b, 'err) t
module Infix = CCResult.Infix
val map_l : ('a -> ('b, 'err) t) -> 'a list -> ('b list, 'err) t
val fold_l : ('b -> 'a -> ('b, 'err) t) -> 'b -> 'a list -> ('b, 'err) t
val fold_seq :
('b -> 'a -> ('b, 'err) t) -> 'b -> 'a sequence -> ('b, 'err) t
val choose : ('a, 'err) t list -> ('a, 'err list) t
val retry : int -> (unit -> ('a, 'err) t) -> ('a, 'err list) t
module type MONAD =
sig
type 'a t
val return : 'a -> 'a t
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
end
module Traverse = CCResult.Traverse
val to_opt : ('a, 'b) t -> 'a option
val of_opt : 'a option -> ('a, string) t
val to_seq : ('a, 'b) t -> 'a sequence
type ('a, 'b) error = [ `Error of 'b | `Ok of 'a ]
val of_err : ('a, 'b) error -> ('a, 'b) t
val to_err : ('a, 'b) t -> ('a, 'b) error
val pp : 'a printer -> ('a, string) t printer
val pp' : 'a printer -> 'e printer -> ('a, 'e) t printer
end