Std.Ref
Mutable references via an algebraic effect, with process-local and ETS-backed handlers.
Types
MutRef
opaque type MutRef aOpaque mutable reference handle. At runtime this is an Erlang reference used as a key into either the process dictionary or an ETS table, depending on which handler is attached.
Effects
Ref
effect Ref {
fun new : a -> MutRef a
fun get : MutRef a -> a
fun set : MutRef a -> a -> Unit
fun modify : MutRef a -> a -> a -> a
}Mutable reference effect. Provides create, read, write, and read-modify-write operations on typed mutable cells.
Handlers
beam_ref
handler beam_ref for RefProcess-dictionary-backed handler. Fast, single-process, no setup needed. Refs are scoped to the current process and cleaned up on process exit.
ets_ref
handler ets_ref for RefETS-backed handler. Refs are stored in a shared ETS table, accessible across processes. Useful when refs need to survive process boundaries.