Skip to content

repeat

repeat(options): <A>(task) => Task<readonly A[]>

Defined in: Core/Task.ts:229

Runs a Task a fixed number of times sequentially, collecting all results into an array. An optional delay duration can be inserted between runs.

Duration

number

<A>(task) => Task<readonly A[]>

pipe(
  pollSensor,
  Task.repeat({ times: 5, delay: Duration.seconds(1) })
)(); // Task<Reading[]> — 5 readings, one per second