mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
Merge pull request #450 from Bronsa/nicola/tup_pipe
feat(CCFun): add (||>)
This commit is contained in:
commit
570e3f8d67
2 changed files with 10 additions and 0 deletions
|
|
@ -64,6 +64,8 @@ module Infix = struct
|
||||||
let ( %> ) = compose
|
let ( %> ) = compose
|
||||||
let[@inline] ( % ) f g x = f (g x)
|
let[@inline] ( % ) f g x = f (g x)
|
||||||
let ( let@ ) = ( @@ )
|
let ( let@ ) = ( @@ )
|
||||||
|
let ( ||> ) (a, b) f = f a b
|
||||||
|
let ( |||> ) (a, b, c) f = f a b c
|
||||||
end
|
end
|
||||||
|
|
||||||
include Infix
|
include Infix
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,14 @@ module Infix : sig
|
||||||
(** [let@ x = foo in bar] is the equivalent of [foo @@ fun x -> bar].
|
(** [let@ x = foo in bar] is the equivalent of [foo @@ fun x -> bar].
|
||||||
It can be very useful for resource management, alongside with {!protect}.
|
It can be very useful for resource management, alongside with {!protect}.
|
||||||
@since 3.11 *)
|
@since 3.11 *)
|
||||||
|
|
||||||
|
val ( ||> ) : 'a * 'b -> ('a -> 'b -> 'c) -> 'c
|
||||||
|
(** [x ||> f] is [f (fst x) (snd x)]
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
val ( |||> ) : 'a * 'b * 'c -> ('a -> 'b -> 'c -> 'd) -> 'd
|
||||||
|
(** like [||>] but for tuples of size 3
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
end
|
end
|
||||||
|
|
||||||
include module type of Infix
|
include module type of Infix
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue