MCPcopy Create free account
hub / github.com/effect-app/libs / fromBuild

Function fromBuild

repos/effect/packages/effect/src/Layer.ts:327–339  ·  view source on GitHub ↗
(
  build: (
    memoMap: MemoMap,
    scope: Scope.Scope
  ) => Effect<Context.Context<ROut>, E, RIn>
)

Source from the content-addressed store, hash-verified

325 *
326 * const program = Database.use((database) => database.query("SELECT 1"))
327 * Effect.runSync(Effect.provide(program, databaseLayer)) // => "result"
328 * ```
329 *
330 * @category constructors
331 * @since 4.0.0
332 */
333export const fromBuild = <ROut, E, RIn>(
334 build: (
335 memoMap: MemoMap,
336 scope: Scope.Scope
337 ) => Effect<Context.Context<ROut>, E, RIn>
338): Layer<ROut, E, RIn> =>
339 fromBuildUnsafe((memoMap: MemoMap, scope: Scope.Scope) => {
340 const layerScope = Scope.forkUnsafe(scope)
341 return internalEffect.onExit(
342 build(memoMap, layerScope),

Callers 4

fromBuildMemoFunction · 0.85
mergeAllFunction · 0.85
provideWithFunction · 0.85
Layer.tsFile · 0.85

Calls 3

fromBuildUnsafeFunction · 0.85
buildFunction · 0.85
closeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…