Hyperlinkv0.8.0-beta.28

Channel

Channel.mapDoneEffectconsteffect/Channel.ts:1820
<OutDone, OutDone2, E, R>(
  f: (o: OutDone) => Effect.Effect<OutDone2, E, R>
): <OutElem, OutErr, InElem, InErr, InDone, Env>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
) => Channel<
  OutElem,
  OutErr | E,
  OutDone2,
  InElem,
  InErr,
  InDone,
  Env | R
>
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, OutDone2, E, R>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  f: (o: OutDone) => Effect.Effect<OutDone2, E, R>
): Channel<OutElem, OutErr | E, OutDone2, InElem, InErr, InDone, Env | R>

Maps the done value of this channel using the specified effectful function.

When to use

Use when the terminal done value transformation needs services or can fail, while emitted elements should pass through unchanged.

sequencing
Source effect/Channel.ts:182022 lines
export const mapDoneEffect: {
  <OutDone, OutDone2, E, R>(
    f: (o: OutDone) => Effect.Effect<OutDone2, E, R>
  ): <OutElem, OutErr, InElem, InErr, InDone, Env>(
    self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
  ) => Channel<OutElem, OutErr | E, OutDone2, InElem, InErr, InDone, Env | R>
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, OutDone2, E, R>(
    self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
    f: (o: OutDone) => Effect.Effect<OutDone2, E, R>
  ): Channel<OutElem, OutErr | E, OutDone2, InElem, InErr, InDone, Env | R>
} = dual(
  2,
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, OutDone2, E, R>(
    self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
    f: (o: OutDone) => Effect.Effect<OutDone2, E, R>
  ): Channel<OutElem, OutErr | E, OutDone2, InElem, InErr, InDone, Env | R> =>
    transformPull(self, (pull) =>
      Effect.succeed(Pull.catchDone(
        pull,
        (done) => Effect.flatMap(f(done as OutDone), Cause.done)
      )))
)
Referenced by 1 symbols