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

Resource overview

Contextual wrappers around @effect/io/Resource

Added in v1.0.0


Table of contents


models

Resource (interface)

Contextual wrappers around @effect/io/Resource

Signature

export interface Resource<I, A, E> extends Tag<I, R.Resource<A, E>> {
  readonly get: Effect.Effect<A, E, I>

  readonly refresh: Effect.Effect<void, E, I>

  readonly auto: <R, Out, R2 = never>(
    acquire: Effect.Effect<A, E, R>,
    policy: Schedule.Schedule<Out, unknown, R2>
  ) => Layer.Layer<I, never, R | R2>

  readonly manual: <R>(acquire: Effect.Effect<A, E, R>) => Layer.Layer<I, never, R>
}

Added in v1.0.0

utils

Resource

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

Signature

export declare function Resource<A, E>(): {
  <const I extends IdentifierFactory<any>>(identifier: I): Resource<IdentifierOf<I>, A, E>
  <const I>(identifier: I): Resource<IdentifierOf<I>, A, E>
}

Added in v1.0.0