effect-io-ai

Package: effect
Module: Function

Function.apply

Applies a function to a given value.

When to use

Use to pass a fixed value into a unary function, especially when the function is the value flowing through pipe.

Details

apply(a)(f) is equivalent to f(a).

Example (Applying an argument to a function)

import { Function, pipe, String } from "effect"
import * as assert from "node:assert"

assert.deepStrictEqual(pipe(String.length, Function.apply("hello")), 5)

See

Signature

declare const apply: <A>(a: A) => <B>(self: (a: A) => B) => B

Source

Since v2.0.0