effect-io-ai

Package: effect
Module: Layer

Layer.effectDiscard

Constructs a layer from an effect, discarding its value and providing no services.

When to use

Use when layer construction should run an Effect for its side effects while providing no services.

Example (Running an effect during layer construction)

import { Effect, Layer } from "effect"

const initLayer = Layer.effectDiscard(
  Effect.sync(() => {
    console.log("Initializing application...")
  })
)

See

Signature

declare const effectDiscard: <X, E, R>(effect: Effect<X, E, R>) => Layer<never, E, Exclude<R, Scope.Scope>>

Source

Since v2.0.0