effect-io-ai

Package: effect
Module: Ref

Ref.get

Gets the current value of the Ref.

When to use

Use to read the current Ref value without changing it.

Example (Getting the current value)

import { Effect, Ref } from "effect"

const program = Effect.gen(function*() {
  const ref = yield* Ref.make(42)
  const value = yield* Ref.get(ref)
  console.log(value) // 42
})

See

Signature

declare const get: <A>(self: Ref<A>) => Effect.Effect<A, never, never>

Source

Since v2.0.0