Hyperlinkv0.8.0-beta.28

Hyperlink

Hyperlink.provideconstsrc/Hyperlink.ts:3749
<ROut, EL, RL, A, E, R>(
  dependency: Layer.Layer<ROut, EL, RL>,
  resources: readonly [
    Layer.Layer<A, E, R>,
    ...ReadonlyArray<Layer.Layer<A, E, R>>
  ]
): Layer.Layer<A, E | EL, Exclude<R, ROut> | RL>

Provide one dependency Layer to several serve layers at once — sugar for Layer.mergeAll(resources).pipe(Layer.provide(dependency)). Reads as "these resources, on this dependency," so a group that shares an implementation states it once:

Hyperlink.provide(ImportHandlers.layer, [
  Hyperlink.serve(SeasonMatches,   seasonMatchesImpl),
  Hyperlink.serve(LiveScorePoller, pollerImpl),
])

It's plain Layer.provide underneath — no config-embedded layer — so sharing stays governed by memoization (same dependency value → one instance; Layer.fresh to isolate).

Compose next to isolated serve layers in the same httpServer list when one resource needs a private dependency and the rest share theirs — that is the escape hatch for the old "rewrite the whole host off the bag API" cliff.

servingservehttpServer
Source src/Hyperlink.ts:37495 lines
export const provide = <ROut, EL, RL, A, E, R>(
  dependency: Layer.Layer<ROut, EL, RL>,
  resources: readonly [Layer.Layer<A, E, R>, ...ReadonlyArray<Layer.Layer<A, E, R>>],
): Layer.Layer<A, E | EL, Exclude<R, ROut> | RL> =>
  Layer.mergeAll(...resources).pipe(Layer.provide(dependency));