feat(CCFun): add (||>)

This commit is contained in:
Nicola Mometto 2024-04-11 14:51:55 +01:00
parent 69cd3ca78d
commit 2a21181580
2 changed files with 4 additions and 0 deletions

View file

@ -64,6 +64,7 @@ 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
end end
include Infix include Infix

View file

@ -81,6 +81,9 @@ 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)] *)
end end
include module type of Infix include module type of Infix