effect-io-ai

Package: effect
Module: Layer

Layer.tap

Performs the specified effect if this layer succeeds.

When to use

Use to run an effectful observation after a layer has been built successfully, such as logging or metrics, without changing the services the layer provides.

Details

The callback receives the services produced by this layer. Its result is discarded, and the original layer output is preserved.

See

Signature

declare const tap: { <ROut, XR extends ROut, RIn2, E2, X>(f: (context: Context.Context<XR>) => Effect<X, E2, RIn2>): <RIn, E>(self: Layer<ROut, E, RIn>) => Layer<ROut, E | E2, RIn | Exclude<RIn2, Scope.Scope>>; <RIn, E, ROut, XR extends ROut, RIn2, E2, X>(self: Layer<ROut, E, RIn>, f: (context: Context.Context<XR>) => Effect<X, E2, RIn2>): Layer<ROut, E | E2, RIn | Exclude<RIn2, Scope.Scope>>; }

Source

Since v2.0.0