Skip to main content Link Search Menu Expand Document (external link)

ScopedRef overview

Contextual wrappers around @effect/io/ScopedRef

Added in v1.0.0


Table of contents


constructors

ScopedRef

Construct a ScopedRef implementation to be utilized from the Effect Context.

Signature

export declare function ScopedRef<A>(): {
  <const I extends IdentifierFactory<any>>(id: I): ScopedRef<IdentifierOf<I>, A>
  <const I>(id: IdentifierInput<I>): ScopedRef<IdentifierOf<I>, A>
}

Added in v1.0.0

models

ScopedRef (interface)

Contextual wrappers around @effect/io/ScopedRef

Signature

export interface ScopedRef<I, A> extends Tag<I, S.ScopedRef<A>> {
  readonly [S.ScopedRefTypeId]: S.ScopedRefTypeId

  // ScopedRef Operators
  readonly get: Effect.Effect<A, never, I>
  readonly set: <E, R>(acquire: Effect.Effect<A, E, R>) => Effect.Effect<void, E, R | I>

  // Provision
  readonly provide: (a: A) => <B, E, R>(effect: Effect.Effect<B, E, R>) => Effect.Effect<B, E, Exclude<R, I> | Scope>
  readonly layer: <E2, R2>(effect: Effect.Effect<A, E2, R2>) => Layer.Layer<I, E2, Exclude<R2, Scope>>
}

Added in v1.0.0