effect-io-ai

Package: effect
Module: Ref

Ref.getUnsafe

Gets the current value of the Ref synchronously (unsafe version).

When to use

Use when you need immediate synchronous access and can guarantee that reading the Ref outside of Effect is safe.

Gotchas

Prefer Ref.get for Effect-wrapped access in Effect programs.

Example (Reading a ref unsafely)

import { Ref } from "effect"

// Create a ref directly
const counter = Ref.makeUnsafe(42)

// Get the value synchronously
const value = Ref.getUnsafe(counter)
console.log(value) // 42

// Note: This is unsafe and should be used carefully
// Prefer Ref.get for Effect-wrapped access

Signature

declare const getUnsafe: <A>(self: Ref<A>) => A

Source

Since v4.0.0