Lazy
Lazy:
object
Defined in: Core/Lazy.ts:16
Type Declaration
Section titled “Type Declaration”chain: <
A,B>(f) => (lazy) =>Lazy<B>
Chains a Lazy-returning transformation without triggering evaluation.
Type Parameters
Section titled “Type Parameters”A
B
Parameters
Section titled “Parameters”(a) => Lazy<B>
Returns
Section titled “Returns”(lazy) => Lazy<B>
Example
Section titled “Example”evaluate
Section titled “evaluate”evaluate: <
A>(lazy) =>A
Forces evaluation and returns the cached result. Safe to call multiple times.
Type Parameters
Section titled “Type Parameters”A
Parameters
Section titled “Parameters”Lazy<A>
Returns
Section titled “Returns”A
Example
Section titled “Example”from: <
A>(f) =>Lazy<A> =fromFn
Wraps a thunk in a Lazy. The thunk runs exactly once, on first evaluate.
Type Parameters
Section titled “Type Parameters”A
Parameters
Section titled “Parameters”() => A
Returns
Section titled “Returns”Lazy<A>
Example
Section titled “Example”map: <
A,B>(f) => (lazy) =>Lazy<B>
Transforms the result of a Lazy without triggering evaluation.
Type Parameters
Section titled “Type Parameters”A
B
Parameters
Section titled “Parameters”(a) => B
Returns
Section titled “Returns”(lazy) => Lazy<B>
Example
Section titled “Example”tap: <
A>(f) => (lazy) =>Lazy<A>
Runs a side effect on the value without changing it. Fires once, on first evaluate.
Type Parameters
Section titled “Type Parameters”A
Parameters
Section titled “Parameters”(a) => void
Returns
Section titled “Returns”(lazy) => Lazy<A>