Hyperlinkv0.8.0-beta.28

Ref

Ref.getconsteffect/Ref.ts:212
<A>(self: Ref<A>): Effect.Effect<A, never, never>

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
})
gettersset
Source effect/Ref.ts:2121 lines
export const get = <A>(self: Ref<A>) => Effect.sync(() => self.ref.current)
Referenced by 8 symbols