Hyperlinkv0.8.0-beta.28

Hyperlink

Hyperlink.provideContextconstsrc/Hyperlink.ts:1301
<Impl, const S extends Spec, Ctx>(
  impl: Impl,
  spec: S,
  context: Context.Context<Ctx>
): ProvidedContext<Impl, Ctx>

Provide a Context.Context to every Effect method of an impl — the one-liner that replaces a repetitive per-method Effect.provideContext(...) wrapping. One-liner over mapEffects; the result subtracts the provided context Ctx from each method's requirement (see ProvidedContext) — RExclude<R, Ctx> — so a worker-R-carrying impl whose context fully covers R becomes the R-free shape ImplOf expects, and a method needing more than Ctx provides keeps a residual requirement (caught at the ImplOf assignment) rather than a false never. Providing the context to a method that carries no R is a harmless no-op, so it applies uniformly. Stream and Subscribable members are left untouched.

const context = yield* Effect.context<R | RR>();
return Hyperlink.provideContext(impl, MyTag[Hyperlink.specSym], context);
Source src/Hyperlink.ts:13018 lines
export const provideContext = <Impl, const S extends Spec, Ctx>(
  impl: Impl,
  spec: S,
  context: Context.Context<Ctx>,
): ProvidedContext<Impl, Ctx> =>
  mapEffects<Impl, S, ProvidedContext<Impl, Ctx>>(impl, spec, (effect) =>
    Effect.provideContext(effect as any, context) as any,
  );
Referenced by 1 symbols