Skip to main content

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

The type of the first function's input value. Corresponds to the return type of the second function.

B

The return type of first function.

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

Remarks

B combinator

λabc.a(bc)

composition :: (a → b) → (c → a) → c → b

pure function

Example

composition((x) => x + 8)((x) => x * 3)(4);
// 20