Follow one execution
Sleeps for duration before forwarding each value; the diagram shows serial delivery.
delayTick 0. Input: a.
Read this diagram
Follow each lane from left to right. Events stacked vertically share a tick; the green cursor marks the current time across every lane.
- A value
The text inside the pill is the emitted value. - Work starts
The raised chevron starts an inner run (^in the source). - The run returns
The vertical bar ends this lane’s run. - A cause is delivered
The exclamation mark belongs to this lane. - Work is interrupted
The cross marks cancellation of this run. - Current time
The line and diamond move together across all lanes. - Happening now
A highlighted event is at the current tick. - Still ahead
Muted, dashed values have not happened yet. - Time continues
The lane’s arrow is not a return marker. An empty stretch can be quiet work that is still running.
Illustrated ticks start at 0. At 1×, one illustrated tick takes one second; captions specify real durations when timing matters. A cause or interruption belongs to its lane, and other work may continue. Scroll horizontally to inspect the rest of a long timeline.
This uses mapEffect and inherits producer concurrency. A serial producer waits for each delayed delivery; concurrent deliveries can overlap their sleeps. No queue or ordering guarantee is added. Source failures propagate and interruption cancels active sleeps.
Import
import { delay } from "@typed/fx/Fx";Signatures
export declare const delay: {
(duration: Duration.Input): <A, E, R>(self: Fx<A, E, R>) => Fx<A, E, R>;
<A, E, R>(self: Fx<A, E, R>, duration: Duration.Input): Fx<A, E, R>;
};Why
Per-value delay is useful when pacing downstream work without changing the stream’s error type or replacing the producer.
Ownership and lifetime
Each delivered value runs an Effect sleep before reaching the sink. This uses
mapEffect and inherits producer concurrency: a sequential producer waits for
each delayed delivery, while concurrent deliveries can overlap their sleeps.
No queue or ordering guarantee is added. The source run must await its pending
deliveries before normal completion. Source failures propagate; interruption
cancels active sleeps. No external resource is retained.
Examples
import { delay } from "@typed/fx/Fx"
import { fromIterable } from "@typed/fx/Fx"
const paced = delay(fromIterable([1, 2, 3]), "100 millis")Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.