(): nullReturns null when called.
When to use
Use when you need a thunk that returns null on every invocation.
Example (Returning null from a thunk)
import { Function } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Function.constNull(), null)constants
Source effect/Function.ts:3871 lines
export const const constNull: LazyArg<null>Returns null when called.
When to use
Use when you need a thunk that returns null on every invocation.
Example (Returning null from a thunk)
import { Function } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Function.constNull(), null)
constNull: type LazyArg<A> = () => AA zero-argument function that produces a value when invoked.
When to use
Use to type a lazy value provider that should not run until called.
Example (Creating a lazy argument)
import { Function } from "effect"
const constNull: Function.LazyArg<null> = Function.constant(null)
LazyArg<null> = const constant: <A>(
value: A
) => LazyArg<A>
Creates a zero-argument function that always returns the provided value.
When to use
Use when you need a thunk or callback that returns the same value on every
invocation.
Example (Creating a constant thunk)
import { Function } from "effect"
import * as assert from "node:assert"
const constNull = Function.constant(null)
assert.deepStrictEqual(constNull(), null)
assert.deepStrictEqual(constNull(), null)
constant(null)Referenced by 2 symbols