mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
add @since tags
This commit is contained in:
parent
cb14c0d04b
commit
02ac5bd78a
2 changed files with 18 additions and 9 deletions
|
|
@ -59,7 +59,8 @@ val bind : 'a t -> ('a -> 'b t) -> 'b t
|
||||||
@since 3.0 *)
|
@since 3.0 *)
|
||||||
|
|
||||||
val k_compose : ('a -> 'b t) -> ('b -> 'c t) -> 'a -> 'c t
|
val k_compose : ('a -> 'b t) -> ('b -> 'c t) -> 'a -> 'c t
|
||||||
(** Kleisli composition. Monadic equivalent of CCFun.compose *)
|
(** Kleisli composition. Monadic equivalent of {!CCFun.compose}
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
|
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
|
||||||
(** [map2 f o1 o2] maps ['a option] and ['b option] to a ['c option] using [f]. *)
|
(** [map2 f o1 o2] maps ['a option] and ['b option] to a ['c option] using [f]. *)
|
||||||
|
|
@ -99,7 +100,7 @@ val apply_or : ('a -> 'a t) -> 'a -> 'a
|
||||||
(** [apply_or f x] returns the original [x] if [f] fails, or unwraps [f x] if it succeeds.
|
(** [apply_or f x] returns the original [x] if [f] fails, or unwraps [f x] if it succeeds.
|
||||||
Useful for piping preprocessing functions together (such as string processing),
|
Useful for piping preprocessing functions together (such as string processing),
|
||||||
turning functions like "remove" into "remove_if_it_exists".
|
turning functions like "remove" into "remove_if_it_exists".
|
||||||
*)
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val value : 'a t -> default:'a -> 'a
|
val value : 'a t -> default:'a -> 'a
|
||||||
(** [value o ~default] is similar to the Stdlib's [Option.value] and to {!get_or}.
|
(** [value o ~default] is similar to the Stdlib's [Option.value] and to {!get_or}.
|
||||||
|
|
@ -185,7 +186,8 @@ module Infix : sig
|
||||||
(** [o1 <+> o2] is [o1] if [o1] is [Some _], [o2] if [o1] is [None]. *)
|
(** [o1 <+> o2] is [o1] if [o1] is [Some _], [o2] if [o1] is [None]. *)
|
||||||
|
|
||||||
val ( |?> ) : 'a -> ('a -> 'a t) -> 'a
|
val ( |?> ) : 'a -> ('a -> 'a t) -> 'a
|
||||||
(** [x |?> f] is [apply_or f x] *)
|
(** [x |?> f] is [apply_or f x]
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val ( let+ ) : 'a t -> ('a -> 'b) -> 'b t
|
val ( let+ ) : 'a t -> ('a -> 'b) -> 'b t
|
||||||
val ( and+ ) : 'a t -> 'b t -> ('a * 'b) t
|
val ( and+ ) : 'a t -> 'b t -> ('a * 'b) t
|
||||||
|
|
@ -193,10 +195,12 @@ module Infix : sig
|
||||||
val ( and* ) : 'a t -> 'b t -> ('a * 'b) t
|
val ( and* ) : 'a t -> 'b t -> ('a * 'b) t
|
||||||
|
|
||||||
val ( >=> ) : ('a -> 'b t) -> ('b -> 'c t) -> 'a -> 'c t
|
val ( >=> ) : ('a -> 'b t) -> ('b -> 'c t) -> 'a -> 'c t
|
||||||
(** Monadic [k_compose]. *)
|
(** Monadic [k_compose].
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val ( <=< ) : ('b -> 'c t) -> ('a -> 'b t) -> 'a -> 'c t
|
val ( <=< ) : ('b -> 'c t) -> ('a -> 'b t) -> 'a -> 'c t
|
||||||
(** Reverse monadic [k_compose]. *)
|
(** Reverse monadic [k_compose].
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
end
|
end
|
||||||
|
|
||||||
include module type of Infix
|
include module type of Infix
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ val apply_or : ('a -> ('a, _) t) -> 'a -> 'a
|
||||||
(** [apply_or f x] returns the original [x] if [f] fails, or unwraps [f x] if it succeeds.
|
(** [apply_or f x] returns the original [x] if [f] fails, or unwraps [f x] if it succeeds.
|
||||||
Useful for piping preprocessing functions together (such as string processing),
|
Useful for piping preprocessing functions together (such as string processing),
|
||||||
turning functions like "remove" into "remove_if_it_exists".
|
turning functions like "remove" into "remove_if_it_exists".
|
||||||
*)
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val get_or_failwith : ('a, string) t -> 'a
|
val get_or_failwith : ('a, string) t -> 'a
|
||||||
(** [get_or_failwith e] returns [x] if [e = Ok x], fails otherwise.
|
(** [get_or_failwith e] returns [x] if [e = Ok x], fails otherwise.
|
||||||
|
|
@ -122,7 +122,8 @@ val flat_map : ('a -> ('b, 'err) t) -> ('a, 'err) t -> ('b, 'err) t
|
||||||
|
|
||||||
val k_compose :
|
val k_compose :
|
||||||
('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t
|
('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t
|
||||||
(** Kleisli composition. Monadic equivalent of CCFun.compose *)
|
(** Kleisli composition. Monadic equivalent of {!CCFun.compose}.
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val equal : err:'err equal -> 'a equal -> ('a, 'err) t equal
|
val equal : err:'err equal -> 'a equal -> ('a, 'err) t equal
|
||||||
val compare : err:'err ord -> 'a ord -> ('a, 'err) t ord
|
val compare : err:'err ord -> 'a ord -> ('a, 'err) t ord
|
||||||
|
|
@ -200,6 +201,8 @@ module Infix : sig
|
||||||
over the error of [b] if both fail. *)
|
over the error of [b] if both fail. *)
|
||||||
|
|
||||||
val ( |?> ) : 'a -> ('a -> ('a, _) t) -> 'a
|
val ( |?> ) : 'a -> ('a -> ('a, _) t) -> 'a
|
||||||
|
(** Alias for {!apply_or}
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val ( let+ ) : ('a, 'e) t -> ('a -> 'b) -> ('b, 'e) t
|
val ( let+ ) : ('a, 'e) t -> ('a -> 'b) -> ('b, 'e) t
|
||||||
(** @since 2.8 *)
|
(** @since 2.8 *)
|
||||||
|
|
@ -215,11 +218,13 @@ module Infix : sig
|
||||||
|
|
||||||
val ( >=> ) :
|
val ( >=> ) :
|
||||||
('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t
|
('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t
|
||||||
(** Monadic [k_compose]. *)
|
(** Monadic [k_compose].
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val ( <=< ) :
|
val ( <=< ) :
|
||||||
('b -> ('c, 'err) t) -> ('a -> ('b, 'err) t) -> 'a -> ('c, 'err) t
|
('b -> ('c, 'err) t) -> ('a -> ('b, 'err) t) -> 'a -> ('c, 'err) t
|
||||||
(** Reverse monadic [k_compose]. *)
|
(** Reverse monadic [k_compose].
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
end
|
end
|
||||||
|
|
||||||
include module type of Infix
|
include module type of Infix
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue