composition()
composition<
A
,B
>(f
): <C
>(g
) => (x
) =>B
Pass a value to a function and then the result to another function.
Type Parameters
• A
• B
Parameters
f
(z
) => B
The second function in the composition.
Returns
Function
Type Parameters
• C
Parameters
g
(y
) => A
Returns
Function
Parameters
x
C
Returns
B
Remark
B combinator
Remark
composition :: (a → b) → (c → a) → c → b
Remark
λabc.a(bc)
Remark
pure function
Example
composition((x) => x + 8)((x) => x * 3)(4);
// 20