Support.Fun
f ++ g
is the function composition of f
and g
, such that (f ++ g) x
is f (g x)
.
f >> g
is the function composition of f
and g
, such that x |> (f >> g)
is g (f x)
.
apply x f
is f x
. This is useful when a function pipeline ends in a call to the generated function.
until f
repeatedly calls the effectful function f
until f ()
is false
. If f
always returns true
, then until f
does not terminate.
through f x
applies the effectful function f
on x
and returns x
. For instance:
... |> through (fun x -> print_string x) |> ...
after f x
calls the effectful function f
and returns x
. This effectively calls f
after executing a function pipeline.
For instance:
... |> through (fun x -> print_string "Success") |> ...
Converts an uncurried function to a curried function.
Converts a curried function to a function on pairs.