Hyperlinkv0.8.0-beta.28

Channel

Channel.bindToconsteffect/Channel.ts:7631
<N extends string>(name: N): <
  OutElem,
  OutErr,
  OutDone,
  InElem,
  InErr,
  InDone,
  Env
>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
) => Channel<
  { [K in N]: OutElem },
  OutErr,
  OutDone,
  InElem,
  InErr,
  InDone,
  Env
>
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, N extends string>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  name: N
): Channel<
  { [K in N]: OutElem },
  OutErr,
  OutDone,
  InElem,
  InErr,
  InDone,
  Env
>

Wraps each output element in an object under the specified field name.

When to use

Use when you need to start a Channel Do-notation chain from an existing output value by assigning that value to a field name.

do notationDobindlet_
Source effect/Channel.ts:763136 lines
export const bindTo: {
  <N extends string>(name: N): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
    self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
  ) => Channel<
    { [K in N]: OutElem },
    OutErr,
    OutDone,
    InElem,
    InErr,
    InDone,
    Env
  >
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, N extends string>(
    self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
    name: N
  ): Channel<
    { [K in N]: OutElem },
    OutErr,
    OutDone,
    InElem,
    InErr,
    InDone,
    Env
  >
} = dual(2, <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, N extends string>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  name: N
): Channel<
  { [K in N]: OutElem },
  OutErr,
  OutDone,
  InElem,
  InErr,
  InDone,
  Env
> => map(self, (elem) => ({ [name]: elem } as any)))