add let operators in Infix

This commit is contained in:
Simon Cruanes 2023-05-04 12:33:00 -04:00
parent 303686319d
commit 02c3e954bf
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 20 additions and 0 deletions

View file

@ -1115,6 +1115,10 @@ module Infix = struct
let[@inline] ( >|= ) x f = map f x let[@inline] ( >|= ) x f = map f x
let[@inline] ( <*> ) funs args k = funs (fun f -> args (fun x -> k (f x))) let[@inline] ( <*> ) funs args k = funs (fun f -> args (fun x -> k (f x)))
let ( <+> ) = append let ( <+> ) = append
let[@inline] ( let+ ) x f = map f x
let[@inline] ( let* ) x f = flat_map f x
let ( and+ ) = product
let ( and* ) = product
end end
include Infix include Infix

View file

@ -794,6 +794,22 @@ module Infix : sig
val ( <+> ) : 'a t -> 'a t -> 'a t val ( <+> ) : 'a t -> 'a t -> 'a t
(** Concatenation of iterators (** Concatenation of iterators
@since 0.5 *) @since 0.5 *)
val ( let+ ) : 'a t -> ('a -> 'b) -> 'b t
(** Alias for {!map}
@since NEXT_RELEASE *)
val ( and+ ) : 'a t -> 'b t -> ('a * 'b) t
(** Alias for {!product}
@since NEXT_RELEASE *)
val ( let* ) : 'a t -> ('a -> 'b t) -> 'b t
(** Alias for {!flat_map}
@since NEXT_RELEASE *)
val ( and* ) : 'a t -> 'b t -> ('a * 'b) t
(** Alias for {!product}
@since NEXT_RELEASE *)
end end
include module type of Infix include module type of Infix