Follow one execution
Repeats the entire stream according to schedule after each successful completion. Failures are not repeated. Schedule.recurs(n) runs the stream n + 1 times (the original plus n repeats), matching Effect Stream.repeat.
repeatTick 0. Source: start.
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.
Runs are strictly sequential. Every source value is forwarded before the Schedule is stepped with void; a successful step sleeps as configured and starts a new source run. A source failure stops immediately and is never repeated. Schedule failure is forwarded; Schedule completion ends normally. Interruption cancels the active source or schedule sleep. No runs overlap.
Import
import { repeat } from "@typed/fx/Fx";Signatures
export declare const repeat: {
<X, E2, R2>(schedule: Schedule.Schedule<X, void, E2, R2>): <A, E, R>(self: Fx<A, E, R>) => Fx<A, E | E2, R | R2>;
<A, E, R, X, E2, R2>(self: Fx<A, E, R>, schedule: Schedule.Schedule<X, void, E2, R2>): Fx<A, E | E2, R | R2>;
};Why
Repetition is a subscription-level decision: after one producer completes, a Schedule decides whether and when a fresh run should begin. Keeping that decision in Effect’s Schedule preserves typed timing services and failures.
Ownership and lifetime
Runs are strictly sequential. Every source value is forwarded before the
Schedule is stepped with void; a successful step sleeps as configured and
starts a new source run. A source failure stops immediately and is never
repeated. Schedule failure is forwarded; Schedule completion ends normally.
Interruption cancels the active source or schedule sleep. No runs overlap.
Examples
import { Schedule } from "effect"
import { repeat } from "@typed/fx/Fx"
import { succeed } from "@typed/fx/Fx"
const threeTicks = repeat(succeed("tick"), Schedule.recurs(2))Other public imports
These import paths expose the same declaration. Each page retains its own public name and signature.