mirror of
https://github.com/c-cube/iter.git
synced 2025-12-06 03:05:29 -05:00
add let operators in Infix
This commit is contained in:
parent
303686319d
commit
02c3e954bf
2 changed files with 20 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
16
src/Iter.mli
16
src/Iter.mli
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue