PredicateTypeLambdaType-level lambda for higher-kinded usage of Predicate.
When to use
Use when you are defining APIs that abstract over predicates with HKTs and
need a TypeLambda instance for predicate-based type classes.
Details
This is type-only, creates no runtime value, and does not affect emitted JavaScript.
Example (Type-level usage)
import { Predicate } from "effect"
type P = Predicate.Predicate<number>
type TL = Predicate.PredicateTypeLambdaexport interface PredicateTypeLambda extends import TypeLambdaTypeLambda {
readonly PredicateTypeLambda.type: Predicate<this["Target"]>type: interface Predicate<in A>A function that decides whether a value of type A satisfies a condition.
When to use
Use when you want a reusable boolean check for A, especially when you plan
to combine checks with
and
/
or
or pass a predicate to arrays
and iterables.
Details
A predicate returns true or false and never throws by itself. It does not
narrow types unless you use Refinement.
Example (Defining a predicate)
import { Predicate } from "effect"
const isPositive: Predicate.Predicate<number> = (n) => n > 0
console.log(isPositive(1))
Type-level utilities for working with
Predicate
types.
When to use
Use when you need to extract input types from predicate signatures while
writing generic helpers over predicate types.
Details
These utilities are type-only, create no runtime values, and the namespace is
erased at runtime.
Example (Extracting predicate input)
import { Predicate } from "effect"
type IsString = Predicate.Predicate<string>
type Input = Predicate.Predicate.In<IsString>
Predicate<this["Target"]>
}