MCPcopy Index your code
hub / github.com/Effect-TS/effect / transplant

Function transplant

packages/effect/src/internal/core.ts:1293–1300  ·  view source on GitHub ↗
(
  f: (grafter: <A2, E2, R2>(effect: Effect.Effect<A2, E2, R2>) => Effect.Effect<A2, E2, R2>) => Effect.Effect<A, E, R>
)

Source from the content-addressed store, hash-verified

1291
1292/* @internal */
1293export const transplant = <A, E, R>(
1294 f: (grafter: <A2, E2, R2>(effect: Effect.Effect<A2, E2, R2>) => Effect.Effect<A2, E2, R2>) => Effect.Effect<A, E, R>
1295): Effect.Effect<A, E, R> =>
1296 withFiberRuntime<A, E, R>((state) => {
1297 const scopeOverride = state.getFiberRef(currentForkScopeOverride)
1298 const scope = pipe(scopeOverride, Option.getOrElse(() => state.scope()))
1299 return f(fiberRefLocally(currentForkScopeOverride, Option.some(scope)))
1300 })
1301
1302/* @internal */
1303export const attemptOrElse: {

Callers

nothing calls this directly

Calls 5

withFiberRuntimeFunction · 0.85
scopeMethod · 0.80
pipeFunction · 0.70
getFiberRefMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected