effect-io-ai

Package: effect
Module: Schedule

Schedule.forever

Returns a new Schedule that will recur forever.

Details

The output of the schedule is the current count of its repetitions thus far (i.e. 0, 1, 2, ...).

Example (Repeating forever)

import { Console, Effect, Schedule } from "effect"

// A schedule that runs forever with no delay
const infiniteSchedule = Schedule.forever

const program = Effect.gen(function*() {
  yield* Effect.repeat(
    Effect.gen(function*() {
      yield* Console.log("Running forever...")
      return "continuous-task"
    }),
    infiniteSchedule.pipe(Schedule.upTo({ times: 5 })) // Limit for demo
  )
})

Signature

declare const forever: Schedule<number, unknown, never, never>

Source

Since v2.0.0