Hyperlinkv0.8.0-beta.28

Channel

Channel.scheduleconsteffect/Channel.ts:3105
<SO, OutElem, SE, SR>(
  schedule: Schedule.Schedule<SO, Types.NoInfer<OutElem>, SE, SR>
): <OutErr, OutDone, InElem, InErr, InDone, Env>(
  self: Channel<
    OutElem,
    OutErr | SE,
    OutDone,
    InElem,
    InErr,
    InDone,
    Env | SR
  >
) => Channel<
  OutElem,
  OutErr | SE,
  OutDone | SO,
  InElem,
  InErr,
  InDone,
  Env | SR
>
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, SO, SE, SR>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  schedule: Schedule.Schedule<SO, OutElem, SE, SR>
): Channel<
  OutElem,
  OutErr | SE,
  OutDone | SO,
  InElem,
  InErr,
  InDone,
  Env | SR
>

Runs a schedule step for each output element while preserving the emitted elements.

Details

The schedule receives each output element as input. Schedule delays are applied between emitted elements. If the schedule fails, the returned channel fails. If the schedule finishes, the returned channel completes with the schedule output.

sequencing
Source effect/Channel.ts:310530 lines
export const schedule: {
  <SO, OutElem, SE, SR>(
    schedule: Schedule.Schedule<SO, Types.NoInfer<OutElem>, SE, SR>
  ): <OutErr, OutDone, InElem, InErr, InDone, Env>(
    self: Channel<OutElem, OutErr | SE, OutDone, InElem, InErr, InDone, Env | SR>
  ) => Channel<OutElem, OutErr | SE, OutDone | SO, InElem, InErr, InDone, Env | SR>
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, SO, SE, SR>(
    self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
    schedule: Schedule.Schedule<SO, OutElem, SE, SR>
  ): Channel<OutElem, OutErr | SE, OutDone | SO, InElem, InErr, InDone, Env | SR>
} = dual(2, <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, SO, SE, SR>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  schedule: Schedule.Schedule<SO, OutElem, SE, SR>
): Channel<OutElem, OutErr | SE, OutDone | SO, InElem, InErr, InDone, Env | SR> =>
  transformPull(
    self,
    (pull, _scope) =>
      Effect.map(
        Schedule.toStepWithSleep(schedule),
        (step) => {
          const pullWithStep: Pull.Pull<
            OutElem,
            OutErr | SE,
            OutDone | SO,
            SR
          > = Effect.tap(pull, step)
          return pullWithStep
        }
      )
  ))
Referenced by 1 symbols