The type of the value to be computed
Readonly_Tag identifying this as a Lazy type
Readonly[toLeft fold operation
Right fold operation
ReadonlyisWhether the computation has been evaluated
Counts elements that satisfy the predicate. For single-value containers: returns 0 or 1 For collections: returns the count of matching elements
Tests whether any element satisfies the predicate. For single-value containers: tests the single value For collections: returns true if any element matches
Applies an effect function to each element. For single-value containers: applies to the value if present For collections: applies to each element
Returns the computed value or throws an error if computation fails
Optionalerror: ErrorOptional custom error to throw. If not provided, throws the computation error or a default error
The computed value
Custom JSON serialization. Forces the thunk (see toValue for the
side-effect contract). Emits {"@functype":"Lazy","_tag":"Lazy","value":T}
on success, or {"@functype":"Lazy","_tag":"Lazy","error":SerializedError}
if the thunk threw — see error-envelope.ts for round-trip semantics.
Creates a string representation of the Lazy
String representation showing evaluation status
Converts the Lazy to a value object.
Forces the thunk as a side effect — Lazy serialization (and projection
to a plain value object) cannot represent an unevaluated thunk in JSON;
forcing is the only way to produce a complete projection. If the thunk
threw, the failure is captured in the error field (real Error, with
full prototype intact for in-memory inspection — toJSON projects to
SerializedError for the wire).
Changed in 1.2.0 — pre-1.2.0 Lazy emitted {_tag, evaluated, value?}
without forcing. See docs/archive/proposals/serializable-audit-q1-q2.md.
The Lazy type represents a computation that is deferred until needed. It provides memoization and safe evaluation with integration to Option, Either, and Try.