Layer54
Constructors
effectconstConstructs a layer from an effect that produces a single service.effectContextconstConstructs a layer from an effect that produces all services in a Context.effectDiscardconstConstructs a layer from an effect, discarding its value and providing no services.emptyconstAn empty layer that provides no services, cannot fail, has no requirements, and performs no construction or finalization work.fromBuildconstConstructs a Layer from a function that uses a MemoMap and Scope to build the layer.fromBuildMemoconstConstructs a Layer from a function that uses a MemoMap and Scope to build the layer, with automatic memoization.succeedconstConstructs a layer that provides a single service from an already available value.succeedContextconstConstructs a layer that provides all services in an already available Context.suspendconstConstructs a layer lazily using the specified factory.syncconstConstructs a layer lazily that provides a single service.syncContextconstConstructs a layer lazily that provides all services in a Context.Models
CurrentMemoMapclassContext service for the current MemoMap used in layer construction.LayerinterfaceA Layer describes how to build one or more services for dependency injection.LayerUnifyinterfaceType-level hook that allows Layer values to participate in Unify inference.LayerUnifyIgnoreinterfaceType-level marker used by Unify for Layer types that should be ignored during unification.MemoMapinterfaceA MemoMap is used to memoize layer construction and ensure sharing of layers.VarianceinterfaceThe variance interface for Layer type parameters.Getters
Sequencing
Destructors
Converting
Error Handling
Layers
Memo Map
buildWithMemoMapconstBuilds a layer into an Effect value, using the specified MemoMap to memoize the layer construction.forkMemoMapconstConstructs a child MemoMap effectfully, allowing it to reuse layers already memoized in the parent while isolating any new layer allocations to the child map.forkMemoMapUnsafeconstConstructs a child MemoMap synchronously, allowing it to reuse layers already memoized in the parent while isolating any new layer allocations to the child map.makeMemoMapconstConstructs a MemoMap effectfully so it can be used to build additional layers.makeMemoMapUnsafeconstConstructs a MemoMap synchronously so it can be used to build additional layers.Options
Providing Services
provideconstFeeds the output services of the dependency layer into the requirements of this layer, returning a layer that only provides the services from this layer.provideMergeconstFeeds the output services of the dependency layer into the requirements of this layer, returning a layer that provides both sets of services.updateServiceconstUpdates a service in the context with a new implementation.Testing
Tracing
parentSpanconstConstructs a layer that provides an existing span as the current parent span.spanconstConstructs a new Layer which creates a span and registers it as the current parent span.withParentSpanconstWraps a layer so spans created during its construction use the supplied span as their parent.withSpanconstWraps a Layer with a new tracing span, making all operations in the layer constructor part of the named trace span.Utility Types
AnyinterfaceA type-level constraint for working with any Layer type.ErrortypeExtracts the error type (E) from a Layer type.satisfiesErrorTypeconstEnsures that a layer's error type extends a given type E.satisfiesServicesTypeconstEnsures that a layer's requirements type extends a given type R.satisfiesSuccessTypeconstEnsures that a layer's success type extends a given type ROut.ServicestypeExtracts the service requirements (RIn) from a Layer type.SuccesstypeExtracts the service output type (ROut) from a Layer type.