(): booleanReturns false when called.
When to use
Use when you need a thunk that returns false on every invocation.
Example (Returning false from a thunk)
import { Function } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Function.constFalse(), false)constants
Source effect/Function.ts:3661 lines
export const const constFalse: LazyArg<boolean>Returns false when called.
When to use
Use when you need a thunk that returns false on every invocation.
Example (Returning false from a thunk)
import { Function } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Function.constFalse(), false)
constFalse: 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<boolean> = 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(false)Referenced by 5 symbols