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

FiberRef overview

Added in v2.0.0


Table of contents


constructors

make

Signature

export declare const make: <A>(
  initial: A,
  options?: { readonly fork?: ((a: A) => A) | undefined; readonly join?: ((left: A, right: A) => A) | undefined }
) => Effect.Effect<FiberRef<A>, never, Scope.Scope>

Added in v2.0.0

makeContext

Signature

export declare const makeContext: <A>(
  initial: Context.Context<A>
) => Effect.Effect<FiberRef<Context.Context<A>>, never, Scope.Scope>

Added in v2.0.0

makeRuntimeFlags

Signature

export declare const makeRuntimeFlags: (
  initial: RuntimeFlags.RuntimeFlags
) => Effect.Effect<FiberRef<RuntimeFlags.RuntimeFlags>, never, Scope.Scope>

Added in v2.0.0

makeWith

Signature

export declare const makeWith: <Value>(
  ref: LazyArg<FiberRef<Value>>
) => Effect.Effect<FiberRef<Value>, never, Scope.Scope>

Added in v2.0.0

unsafeMake

Signature

export declare const unsafeMake: <Value>(
  initial: Value,
  options?: {
    readonly fork?: ((a: Value) => Value) | undefined
    readonly join?: ((left: Value, right: Value) => Value) | undefined
  }
) => FiberRef<Value>

Added in v2.0.0

unsafeMakeContext

Signature

export declare const unsafeMakeContext: <A>(initial: Context.Context<A>) => FiberRef<Context.Context<A>>

Added in v2.0.0

unsafeMakeHashSet

Signature

export declare const unsafeMakeHashSet: <A>(initial: HashSet.HashSet<A>) => FiberRef<HashSet.HashSet<A>>

Added in v2.0.0

unsafeMakePatch

Signature

export declare const unsafeMakePatch: <Value, Patch>(
  initial: Value,
  options: {
    readonly differ: Differ.Differ<Value, Patch>
    readonly fork: Patch
    readonly join?: ((oldV: Value, newV: Value) => Value) | undefined
  }
) => FiberRef<Value>

Added in v2.0.0

unsafeMakeSupervisor

Signature

export declare const unsafeMakeSupervisor: (initial: Supervisor.Supervisor<any>) => FiberRef<Supervisor.Supervisor<any>>

Added in v2.0.0

fiberRefs

currentConcurrency

Signature

export declare const currentConcurrency: FiberRef<number | "unbounded">

Added in v2.0.0

currentContext

Signature

export declare const currentContext: FiberRef<Context.Context<never>>

Added in v2.0.0

currentLogAnnotations

Signature

export declare const currentLogAnnotations: FiberRef<HashMap.HashMap<string, unknown>>

Added in v2.0.0

currentLogLevel

Signature

export declare const currentLogLevel: FiberRef<LogLevel.LogLevel>

Added in v2.0.0

currentLogSpan

Signature

export declare const currentLogSpan: FiberRef<List.List<LogSpan.LogSpan>>

Added in v2.0.0

currentLoggers

Signature

export declare const currentLoggers: FiberRef<HashSet.HashSet<Logger.Logger<unknown, any>>>

Added in v2.0.0

currentMaxOpsBeforeYield

Signature

export declare const currentMaxOpsBeforeYield: FiberRef<number>

Added in v2.0.0

currentMetricLabels

Signature

export declare const currentMetricLabels: FiberRef<readonly MetricLabel.MetricLabel[]>

Added in v2.0.0

currentMinimumLogLevel

Signature

export declare const currentMinimumLogLevel: FiberRef<LogLevel.LogLevel>

Added in v2.0.0

currentRequestBatchingEnabled

Signature

export declare const currentRequestBatchingEnabled: FiberRef<boolean>

Added in v2.0.0

currentRequestCache

Signature

export declare const currentRequestCache: FiberRef<Request.Cache>

Added in v2.0.0

currentRequestCacheEnabled

Signature

export declare const currentRequestCacheEnabled: FiberRef<boolean>

Added in v2.0.0

currentRuntimeFlags

Signature

export declare const currentRuntimeFlags: FiberRef<RuntimeFlags.RuntimeFlags>

Added in v2.0.0

currentScheduler

Signature

export declare const currentScheduler: FiberRef<Scheduler.Scheduler>

Added in v2.0.0

currentSchedulingPriority

Signature

export declare const currentSchedulingPriority: FiberRef<number>

Added in v2.0.0

currentSupervisor

Signature

export declare const currentSupervisor: FiberRef<Supervisor.Supervisor<any>>

Added in v2.0.0

currentTracerEnabled

Signature

export declare const currentTracerEnabled: FiberRef<boolean>

Added in v2.0.0

currentTracerSpanAnnotations

Signature

export declare const currentTracerSpanAnnotations: FiberRef<HashMap.HashMap<string, unknown>>

Added in v2.0.0

Signature

export declare const currentTracerSpanLinks: FiberRef<Chunk.Chunk<Tracer.SpanLink>>

Added in v2.0.0

currentTracerTimingEnabled

Signature

export declare const currentTracerTimingEnabled: FiberRef<boolean>

Added in v2.0.0

interruptedCause

Signature

export declare const interruptedCause: FiberRef<Cause.Cause<never>>

Added in v2.0.0

unhandledErrorLogLevel

Signature

export declare const unhandledErrorLogLevel: FiberRef<Option.Option<LogLevel.LogLevel>>

Added in v2.0.0

getters

get

Signature

export declare const get: <A>(self: FiberRef<A>) => Effect.Effect<A>

Added in v2.0.0

model

FiberRef (interface)

Signature

export interface FiberRef<in out A> extends Effect.Effect<A>, Variance<A> {
  /** @internal */
  readonly initial: A
  /** @internal */
  diff(oldValue: A, newValue: A): unknown
  /** @internal */
  combine(first: unknown, second: unknown): unknown
  /** @internal */
  patch(patch: unknown): (oldValue: A) => A
  /** @internal */
  readonly fork: unknown
  /** @internal */
  join(oldValue: A, newValue: A): A
  readonly [Unify.typeSymbol]?: unknown
  readonly [Unify.unifySymbol]?: FiberRefUnify<this>
  readonly [Unify.ignoreSymbol]?: FiberRefUnifyIgnore
}

Added in v2.0.0

models

FiberRefUnify (interface)

Signature

export interface FiberRefUnify<A extends { [Unify.typeSymbol]?: any }> extends Effect.EffectUnify<A> {
  FiberRef?: () => Extract<A[Unify.typeSymbol], FiberRef<any>>
}

Added in v3.8.0

FiberRefUnifyIgnore (interface)

Signature

export interface FiberRefUnifyIgnore extends Effect.EffectUnifyIgnore {
  Effect?: true
}

Added in v3.8.0

Variance (interface)

Signature

export interface Variance<in out A> {
  readonly [FiberRefTypeId]: {
    readonly _A: Types.Invariant<A>
  }
}

Added in v2.0.0

symbols

FiberRefTypeId

Signature

export declare const FiberRefTypeId: typeof FiberRefTypeId

Added in v2.0.0

FiberRefTypeId (type alias)

Signature

export type FiberRefTypeId = typeof FiberRefTypeId

Added in v2.0.0

utils

delete

Signature

export declare const delete: <A>(self: FiberRef<A>) => Effect.Effect<void>

Added in v2.0.0

getAndSet

Signature

export declare const getAndSet: {
  <A>(value: A): (self: FiberRef<A>) => Effect.Effect<A>
  <A>(self: FiberRef<A>, value: A): Effect.Effect<A>
}

Added in v2.0.0

getAndUpdate

Signature

export declare const getAndUpdate: {
  <A>(f: (a: A) => A): (self: FiberRef<A>) => Effect.Effect<A>
  <A>(self: FiberRef<A>, f: (a: A) => A): Effect.Effect<A>
}

Added in v2.0.0

getAndUpdateSome

Signature

export declare const getAndUpdateSome: {
  <A>(pf: (a: A) => Option.Option<A>): (self: FiberRef<A>) => Effect.Effect<A>
  <A>(self: FiberRef<A>, pf: (a: A) => Option.Option<A>): Effect.Effect<A>
}

Added in v2.0.0

getWith

Signature

export declare const getWith: {
  <A, B, E, R>(f: (a: A) => Effect.Effect<B, E, R>): (self: FiberRef<A>) => Effect.Effect<B, E, R>
  <A, B, E, R>(self: FiberRef<A>, f: (a: A) => Effect.Effect<B, E, R>): Effect.Effect<B, E, R>
}

Added in v2.0.0

modify

Signature

export declare const modify: {
  <A, B>(f: (a: A) => readonly [B, A]): (self: FiberRef<A>) => Effect.Effect<B>
  <A, B>(self: FiberRef<A>, f: (a: A) => readonly [B, A]): Effect.Effect<B>
}

Added in v2.0.0

modifySome

Signature

export declare const modifySome: <A, B>(
  self: FiberRef<A>,
  def: B,
  f: (a: A) => Option.Option<readonly [B, A]>
) => Effect.Effect<B>

Added in v2.0.0

reset

Signature

export declare const reset: <A>(self: FiberRef<A>) => Effect.Effect<void>

Added in v2.0.0

set

Signature

export declare const set: {
  <A>(value: A): (self: FiberRef<A>) => Effect.Effect<void>
  <A>(self: FiberRef<A>, value: A): Effect.Effect<void>
}

Added in v2.0.0

update

Signature

export declare const update: {
  <A>(f: (a: A) => A): (self: FiberRef<A>) => Effect.Effect<void>
  <A>(self: FiberRef<A>, f: (a: A) => A): Effect.Effect<void>
}

Added in v2.0.0

updateAndGet

Signature

export declare const updateAndGet: {
  <A>(f: (a: A) => A): (self: FiberRef<A>) => Effect.Effect<A>
  <A>(self: FiberRef<A>, f: (a: A) => A): Effect.Effect<A>
}

Added in v2.0.0

updateSome

Signature

export declare const updateSome: {
  <A>(pf: (a: A) => Option.Option<A>): (self: FiberRef<A>) => Effect.Effect<void>
  <A>(self: FiberRef<A>, pf: (a: A) => Option.Option<A>): Effect.Effect<void>
}

Added in v2.0.0

updateSomeAndGet

Signature

export declare const updateSomeAndGet: {
  <A>(pf: (a: A) => Option.Option<A>): (self: FiberRef<A>) => Effect.Effect<A>
  <A>(self: FiberRef<A>, pf: (a: A) => Option.Option<A>): Effect.Effect<A>
}

Added in v2.0.0