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
Parameters
a
A
The value to return.
Returns
Function
Type Parameters
• B
Parameters
_
B
Returns
A
Remark
K combinator
Remark
constant :: a → b → a
Remark
λab.a
Remark
pure function
Example
constant(1)(2);
// 1