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