Hyperlinkv0.8.0-beta.28

Ref

Ref.getUnsafeconsteffect/Ref.ts:801
<A>(self: Ref<A>): A

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
getters
Source effect/Ref.ts:8011 lines
export const getUnsafe = <A>(self: Ref<A>): A => self.ref.current