fork()
fork<
A,B,C>(a): <D>(b) => (c) => (d) =>C
Pass a value through two different functions and the results to a function that takes two arguments.
Type Parameters
A
A
The type of the first input to the binary function. Corresponds to the return type of the first function.
B
B
The type of the second input to the binary function. Corresponds to the return type of the second function.
C
C
The return type of the binary function.
Parameters
a
(x) => (y) => C
The final curried, binary function that receives the results from b and c.
Returns
<
D>(b): (c) => (d) =>C
Type Parameters
D
D
Parameters
b
(x) => A
Returns
(
c): (d) =>C
Parameters
c
(x) => B
Returns
(
d):C
Parameters
d
D
Returns
C
Remarks
Phi combinator
λabcd.a(bd)(cd)
'fork :: (a → b → c) → (d → a) → (d → b) → d → c'
pure function
Example
fork((x) => (y) => x + y)(x => x + 3)(x => x - 2)(9)
// 19