mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-08 12:15:32 -05:00
add CCError.Infix module
This commit is contained in:
parent
3a178aa81a
commit
ebdf201161
2 changed files with 18 additions and 0 deletions
|
|
@ -195,6 +195,14 @@ let retry n f =
|
||||||
| `Error e -> retry (n-1) (e::acc)
|
| `Error e -> retry (n-1) (e::acc)
|
||||||
in retry n []
|
in retry n []
|
||||||
|
|
||||||
|
(** {2 Infix} *)
|
||||||
|
|
||||||
|
module Infix = struct
|
||||||
|
let (>>=) = (>>=)
|
||||||
|
let (>|=) = (>|=)
|
||||||
|
let (<*>) = (<*>)
|
||||||
|
end
|
||||||
|
|
||||||
(** {2 Monadic Operations} *)
|
(** {2 Monadic Operations} *)
|
||||||
|
|
||||||
module type MONAD = sig
|
module type MONAD = sig
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,16 @@ val (<*>) : ('a -> 'b, 'err) t -> ('a, 'err) t -> ('b, 'err) t
|
||||||
[`Ok (a b)]. Otherwise, it fails, and the error of [a] is chosen
|
[`Ok (a b)]. Otherwise, it fails, and the error of [a] is chosen
|
||||||
over the error of [b] if both fail *)
|
over the error of [b] if both fail *)
|
||||||
|
|
||||||
|
(** {2 Infix}
|
||||||
|
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
module Infix : sig
|
||||||
|
val (>|=) : ('a, 'err) t -> ('a -> 'b) -> ('b, 'err) t
|
||||||
|
val (>>=) : ('a, 'err) t -> ('a -> ('b, 'err) t) -> ('b, 'err) t
|
||||||
|
val (<*>) : ('a -> 'b, 'err) t -> ('a, 'err) t -> ('b, 'err) t
|
||||||
|
end
|
||||||
|
|
||||||
(** {2 Collections} *)
|
(** {2 Collections} *)
|
||||||
|
|
||||||
val map_l : ('a -> ('b, 'err) t) -> 'a list -> ('b list, 'err) t
|
val map_l : ('a -> ('b, 'err) t) -> 'a list -> ('b list, 'err) t
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue