effect-io-ai

Package: effect
Module: Ref

Ref.makeUnsafe

Creates a new Ref with the specified initial value (unsafe version).

When to use

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

Gotchas

Prefer Ref.make for Effect-wrapped creation in Effect programs.

Example (Creating a ref unsafely)

import { Ref } from "effect"

// Create a ref directly without Effect
const counter = Ref.makeUnsafe(0)

// Get the current value
const value = Ref.getUnsafe(counter)
console.log(value) // 0

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

Signature

declare const makeUnsafe: <A>(value: A) => Ref<A>

Source

Since v4.0.0