effect-io-ai

Package: effect
Module: Schedule

Schedule.passthrough

Returns a new Schedule that outputs the inputs of the specified schedule.

Example (Passing inputs through as outputs)

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

// Create a schedule that outputs the inputs instead of original outputs
const inputSchedule = Schedule.passthrough(
  Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 3 }))
)

const program = Effect.gen(function*() {
  let counter = 0
  yield* Effect.repeat(
    Effect.gen(function*() {
      counter++
      yield* Console.log(`Task ${counter} executed`)
      return `result-${counter}`
    }),
    inputSchedule
  )
})

Signature

declare const passthrough: <Output, Input, Error, Env>(self: Schedule<Output, Input, Error, Env>) => Schedule<Input, Input, Error, Env>

Source

Since v2.0.0