Skip to main content

constant()

constant<A>(a): <B>(_) => A

Corresponds to the encoding of true in the lambda calculus. Takes two arguments and always returns the first.

Type Parameters

A

A

The type of the first input value.

Parameters

a

A

The value to return.

Returns

<B>(_): A

Type Parameters

B

B

Parameters

_

B

Returns

A

Remarks

K combinator

λab.a

constant :: a → b → a

pure function

Example

constant(1)(2);
// 1