/** * Provides a layer to the effect, which translates it to another level. * * @tsplus static effect/core/io/Effect.Aspects provideLayer * @tsplus pipeable effect/core/io/Effect provideLayer */ export function provideLayer(layer: Layer) { return (self: Effect): Effect => Effect.acquireUseReleaseExit( Scope.make, (scope) => layer.buildWithScope(scope).flatMap((r) => self.provideEnvironment(r)), (scope, exit) => scope.close(exit) ) }