Hyperlinkv0.8.0-beta.28

Channel

Channel.provideServiceconsteffect/Channel.ts:7218
<I, S>(key: Context.Key<I, S>, service: NoInfer<S>): <
  OutElem,
  OutErr,
  OutDone,
  InElem,
  InErr,
  InDone,
  Env
>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
) => Channel<
  OutElem,
  OutErr,
  OutDone,
  InElem,
  InErr,
  InDone,
  Exclude<Env, I>
>
<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, I, S>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  key: Context.Key<I, S>,
  service: NoInfer<S>
): Channel<
  OutElem,
  OutErr,
  OutDone,
  InElem,
  InErr,
  InDone,
  Exclude<Env, I>
>

Provides a concrete service for a context key, removing that service requirement from the returned channel.

services
Source effect/Channel.ts:721823 lines
export const provideService: {
  <I, S>(
    key: Context.Key<I, S>,
    service: NoInfer<S>
  ): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
    self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
  ) => Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Exclude<Env, I>>
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, I, S>(
    self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
    key: Context.Key<I, S>,
    service: NoInfer<S>
  ): Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Exclude<Env, I>>
} = dual(3, <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, I, S>(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  key: Context.Key<I, S>,
  service: NoInfer<S>
): Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Exclude<Env, I>> =>
  fromTransform((upstream, scope) =>
    Effect.map(
      Effect.provideService(toTransform(self)(upstream, scope), key, service),
      Effect.provideService(key, service)
    )
  ))
Referenced by 2 symbols