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
• B
• C
Parameters
a
(x
) => (y
) => C
The final curried, binary function that receives the results from b
and c
.
Returns
Function
Type Parameters
• D
Parameters
b
(x
) => A
Returns
Function
Parameters
c
(x
) => B
Returns
Function
Parameters
d
D
Returns
C
Remark
Phi combinator
Remark
'fork :: (a → b → c) → (d → a) → (d → b) → d → c'
Remark
λabcd.a(bd)(cd)
Remark
pure function
Example
fork((x) => (y) => x + y)(x => x + 3)(x => x - 2)(9)
// 19