Std.Otp.Raw (Cure Standard Library v0.37.2)

View Source

SEALED unsafe raw base for the typed BEAM process algebra.

Honest, permissive, effect-typed externs over stock Erlang/OTP BIFs — the only trust boundary for concurrency. Std.Otp narrows these into a typed algebra (Pid(m), session channels) and is the sanctioned surface; nothing here is meant for direct use. Every operation that performs a BEAM side effect returns Effect(T) (design 2026-07-09-effect-type-former §3.3, 2026-07-10-checked-beam-concurrency §2), which the old pure @extern types (the "purity lie") did not.

The effect discipline forbids duplicating, dropping, or reordering an OPERATION — that is a statement about the PROGRAM'S EFFECT SEQUENCE, not about the mailbox. The BEAM itself guarantees far less, and nothing here may assume otherwise:

  • NO DELIVERY. A send to a dead process silently succeeds. Nothing here promises a message arrives, and no typed op sequences on arrival.
  • ORDERING IS PAIRWISE ONLY. Signals from the SAME sender to the SAME target arrive in order — messages and exit signals alike. Order between DIFFERENT senders is unspecified.

(Bereczky/Horpácsi/Thompson, A Formalisation of Core Erlang, Thm. 2 and Ex. 3; verified against AtomVM in https://github.com/cure-lang/cure-otp/tree/main/docs/research/process-types/raw-algebra-conformance-checklist.md.)

Messages and replies are POLYMORPHIC, not Any: the type variable is the narrow point where Std.Otp supplies the message-set code m. Payloads must be first-order serialisable data (the BEAM copies messages); the typed layer enforces that.

Process creation receives a function, never a bare Effect value. The function boundary is the honest raw representation of a fresh BEAM process; typed wrappers choose the indexed handle exposed to callers.

Which BEAM protocol a process handle speaks — a PHANTOM TAG, carried as RawPid's third type argument. A plain process answers only raw sends; a gen_server additionally answers call/cast/stop. Neither tag has values and neither reaches the BEAM: the distinction is erased entirely.

Examples

use Std.Otp.Raw

let boxed = raw_term(1, %[:ok, :raw_term])
raw_term_is_atom(boxed)                  # => true
raw_term_is_integer(boxed)               # => false

Summary

Types

A process handle with NO message-type claim — what a registry lookup can honestly give you. Supervisable (link/monitor/exit/is_alive never cared about the message type) but not sendable. Recovering a TYPED handle from a name needs a name-to-code association nothing builds yet; that is F-1 (see the audit, §6).

An uninhabited message type. BarePid carries it, which is what makes a pid recovered from the registry UNSENDABLE: tell would demand a NoMessage value and no constructor produces one.

Functions

Attach erased actor protocol indices to an already PID-validated carrier. This is the construction trust point used by Std.Otp.start_actor; it does not accept an arbitrary BeamTerm.

Synchronous gen_server call — the typed Std.Otp surface narrows this raw, return-polymorphic boundary. Server-only: calling a plain process blocks the caller for 5s and then exits it.

Dependent-reply variant of raw_call: the server's reply-index slot kr and the RESULT res are DECOUPLED, so the caller may choose res = ReplyOf(request) — a function of the EXPLICIT request. Same BIF (gen_server:call/2), same partiality/trust as raw_call; Std.Otp.call_dep threads it.

Cancel a timer. erlang:cancel_timer/1 returns the REMAINING MILLISECONDS, or false once the timer has already fired or been cancelled. It is not Unit and never was — the sharpest of the Effect(Unit) lies.

Asynchronous gen_server cast — no reply. Server-only: a plain process does not implement the gen_server protocol. Returns the atom ok.

Remove a monitor. Returns true. Honest over the bare Ref — erlang:demonitor/1 accepts any reference — and drives no typed wrapper: the typed demonitor flushes.

erlang:demonitor/2 with [flush] — removes the monitor AND discards a DOWN that has already been delivered. The option list is a real parameter, not baked in. With flush and no info, the BIF always returns true.

Send an exit signal and query process liveness. erlang:exit/2 returns true.

Check whether pid is alive on the local node (:erlang.is_process_alive/1).

Link and unlink the current process to a target. Both return true.

Establish a monitor on pid; the returned MonitorRef tags the DOWN message.

── Name: typed process registration (the F-1 typed name → handle) ──

Unregister name, returning true if it was registered and false otherwise.

Look up name in the local registry as a typed Option(RawPid(m, m, Plain)).

The registry operations deliberately remain raw and effect-typed. A higher layer may expose a name-indexed handle without asserting that a dynamic registry lookup is always successful.

Reply explicitly to a gen_server caller. The public wrapper gives the callback-side from value a linear binder before consuming it.

Create an empty Selector(p) with no registered subject handlers.

Receive from whichever subject registered on selector delivers first within timeout ms, or None on timeout.

The calling process's own pid. A process the VM spawned for us speaks no gen_server protocol, so the handle is Plain.

Send msg to dest. Fire-and-forget; the effect is performing the send. Tag-polymorphic: a raw send to a gen_server is legitimate — it lands in handle_info. erlang:send/2 returns the MESSAGE, not ok.

Schedule a message for a process and receive an opaque timer reference.

Synchronous call against a RawServerPid actor via :gen_server.call/2.

Dependent-reply synchronous call against a RawServerPid via :gen_server.call/2.

Asynchronously cast msg to a RawServerPid actor via :gen_server.cast/2.

Stop a RawServerPid actor via :gen_server.stop/1. Returns :ok.

Spawn a new unlinked BEAM process executing thunk (:erlang.spawn/1).

Spawn a new BEAM process linked to the caller (:erlang.spawn_link/1).

Start a gen_server through its standard callback module. The raw return is deliberately the OTP {ok, pid}/error tuple; a behavior-specific wrapper narrows that contract after the callback context is established.

Honest inbound form: unlike the compatibility Tuple signature, this admits every OTP outcome ({:ok,pid}, {:error,reason}, or :ignore).

Start an unnamed gen_server via :gen_server.start_link/3.

Start a gen_statem through its standard callback module. The raw return is deliberately the OTP {ok, pid}/error tuple; the transparent FSM macro supplies the behavior-specific callback contract.

Start an unnamed gen_statem and return the raw OTP outcome as a RawTerm, admitting {:ok, pid}, {:error, reason}, and :ignore.

Stop a generic OTP process. The reason is intentionally polymorphic at this raw boundary; typed lifecycle wrappers choose the narrower reason type required by their behavior. Server-only, like the rest of the gen_server protocol. Returns the atom ok.

── Subject: a typed message ADDRESS {owner_pid, tag_ref} (Gleam-style, F-1 addressing) ──

Receive the next message tagged for subject within timeout ms, or None.

Send a tagged message to subject via Cure.Otp.Builtins.subject_send/2.

Promote a validated BarePid to a RawSupervisorPid carrier.

Stop a running supervisor via :gen_server.stop/3 with reason and timeout.

Erase a statically typed value into a RawTerm by projecting it out of a tagged box via :erlang.element/2.

Extract an Atom from a RawTerm after raw_term_is_atom succeeds.

The guard that admits this extraction is raw_term_is_binary, so what comes out is a Binary — not a Cure String, which is nominal and erases to {String, code_points}. Std.Beam.decode_string decodes the binary.

Extract a Bool from a RawTerm after raw_term_is_boolean succeeds.

Extract a Float from a RawTerm after raw_term_is_float succeeds.

Extract an Int from a RawTerm after raw_term_is_integer succeeds.

Safe inbound observation floor. Predicates never refine by themselves; the representation-preserving projections below are used only after the corresponding predicate succeeds in Std.Beam.

Return true if the erased RawTerm is a binary (:erlang.is_binary/1).

Return true if the erased RawTerm is a boolean (:erlang.is_boolean/1).

Return true if the erased RawTerm is a float (:erlang.is_float/1).

Return true if the erased RawTerm is an integer (:erlang.is_integer/1).

Return true if the erased RawTerm is a BEAM PID (:erlang.is_pid/1).

Return true if the erased RawTerm is a BEAM tuple (:erlang.is_tuple/1).

Extract a BarePid from a RawTerm after raw_term_is_pid succeeds.

Project the 1-based index-th element from a checked tuple RawTerm.

Return the arity of a RawTerm previously checked with raw_term_is_tuple.

Remove a link between the calling process and pid (:erlang.unlink/1).

Remove the local registration for name (:erlang.unregister/1).

whereis returns the bare atom undefined when the name is not registered — that is the BIF's real contract, and typing it as a pid would let a well-typed handle BE the atom undefined. The FFI boundary re-tags the union: :undefined by exact value, the pid by the is_pid guard @erases(:pid) declares. Std.Otp.whereis turns that into an Option.

Types

type BarePid

 type BarePid

A process handle with NO message-type claim — what a registry lookup can honestly give you. Supervisable (link/monitor/exit/is_alive never cared about the message type) but not sendable. Recovering a TYPED handle from a name needs a name-to-code association nothing builds yet; that is F-1 (see the audit, §6).

enum NoMessage

 enum NoMessage

An uninhabited message type. BarePid carries it, which is what makes a pid recovered from the registry UNSENDABLE: tell would demand a NoMessage value and no constructor produces one.

Functions

raw_actor_server(m: Type, q: Type, r: Type, index: Int, checked: Tuple(BarePid, Atom)) -> RawServerPid(m, q, r)

 fn raw_actor_server(m: Type, q: Type, r: Type, index: Int, checked: Tuple(BarePid, Atom)) -> RawServerPid(m, q, r)

Attach erased actor protocol indices to an already PID-validated carrier. This is the construction trust point used by Std.Otp.start_actor; it does not accept an arbitrary BeamTerm.

raw_call(q: Type, r: Type, server: RawPid(q, r, Server), req: q) -> Effect(r)

 fn raw_call(q: Type, r: Type, server: RawPid(q, r, Server), req: q) -> Effect(r)

Synchronous gen_server call — the typed Std.Otp surface narrows this raw, return-polymorphic boundary. Server-only: calling a plain process blocks the caller for 5s and then exits it.

⚠ PARTIAL. On timeout (default 5000 ms) or server death the CALLER EXITS. No value is returned at the wrong type — there is simply no continuation — so Effect(r) is sound but not total. A try_call that reifies the failure needs a try/catch shim and is deferred (audit §6).

raw_call_dep(q: Type, kr: Type, res: Type, server: RawPid(q, kr, Server), req: q) -> Effect(res)

 fn raw_call_dep(q: Type, kr: Type, res: Type, server: RawPid(q, kr, Server), req: q) -> Effect(res)

Dependent-reply variant of raw_call: the server's reply-index slot kr and the RESULT res are DECOUPLED, so the caller may choose res = ReplyOf(request) — a function of the EXPLICIT request. Same BIF (gen_server:call/2), same partiality/trust as raw_call; Std.Otp.call_dep threads it.

raw_cancel_timer(ref: TimerRef) -> Effect(Int | Bool)

 fn raw_cancel_timer(ref: TimerRef) -> Effect(Int | Bool)

Cancel a timer. erlang:cancel_timer/1 returns the REMAINING MILLISECONDS, or false once the timer has already fired or been cancelled. It is not Unit and never was — the sharpest of the Effect(Unit) lies.

raw_cast(q: Type, r: Type, server: RawPid(q, r, Server), msg: q) -> Effect(Atom)

 fn raw_cast(q: Type, r: Type, server: RawPid(q, r, Server), msg: q) -> Effect(Atom)

Asynchronous gen_server cast — no reply. Server-only: a plain process does not implement the gen_server protocol. Returns the atom ok.

raw_demonitor(ref: Ref) -> Effect(Bool)

 fn raw_demonitor(ref: Ref) -> Effect(Bool)

Remove a monitor. Returns true. Honest over the bare Ref — erlang:demonitor/1 accepts any reference — and drives no typed wrapper: the typed demonitor flushes.

raw_demonitor_flush(ref: MonitorRef, opts: List(Atom)) -> Effect(Bool)

 fn raw_demonitor_flush(ref: MonitorRef, opts: List(Atom)) -> Effect(Bool)

erlang:demonitor/2 with [flush] — removes the monitor AND discards a DOWN that has already been delivered. The option list is a real parameter, not baked in. With flush and no info, the BIF always returns true.

raw_dep_actor_base(m: Type, q: Type, rep: Function(q, Type), index: Int, checked: Tuple(RawDepServerPid(m, q, rep), Atom)) -> RawServerPid(m, q, Unit)

 fn raw_dep_actor_base(m: Type, q: Type, rep: Function(q, Type), index: Int, checked: Tuple(RawDepServerPid(m, q, rep), Atom)) -> RawServerPid(m, q, Unit)

Project a RawDepServerPid back to its underlying RawServerPid carrier.

raw_dep_actor_server(m: Type, q: Type, rep: Function(q, Type), index: Int, checked: Tuple(RawServerPid(m, q, Unit), Atom)) -> RawDepServerPid(m, q, rep)

 fn raw_dep_actor_server(m: Type, q: Type, rep: Function(q, Type), index: Int, checked: Tuple(RawServerPid(m, q, Unit), Atom)) -> RawDepServerPid(m, q, rep)

Re-index a RawServerPid with a dependent request-indexed reply family rep.

raw_exit(m: Type, r: Type, k: Type, x: Type, pid: RawPid(m, r, k), reason: x) -> Effect(Bool)

 fn raw_exit(m: Type, r: Type, k: Type, x: Type, pid: RawPid(m, r, k), reason: x) -> Effect(Bool)

Send an exit signal and query process liveness. erlang:exit/2 returns true.

raw_fsm_pid(event: Type, state: Type, data: Type, index: Int, checked: Tuple(BarePid, Atom)) -> RawFsmPid(event, state, data)

 fn raw_fsm_pid(event: Type, state: Type, data: Type, index: Int, checked: Tuple(BarePid, Atom)) -> RawFsmPid(event, state, data)

Attach erased FSM event/state/data indices to a validated BarePid.

raw_is_alive(m: Type, r: Type, k: Type, pid: RawPid(m, r, k)) -> Effect(Bool)

 fn raw_is_alive(m: Type, r: Type, k: Type, pid: RawPid(m, r, k)) -> Effect(Bool)

Check whether pid is alive on the local node (:erlang.is_process_alive/1).

raw_link(m: Type, r: Type, k: Type, pid: RawPid(m, r, k)) -> Effect(Bool)

 fn raw_link(m: Type, r: Type, k: Type, pid: RawPid(m, r, k)) -> Effect(Bool)

Link and unlink the current process to a target. Both return true.

raw_monitor(m: Type, r: Type, k: Type, kind: Atom, pid: RawPid(m, r, k)) -> Effect(MonitorRef)

 fn raw_monitor(m: Type, r: Type, k: Type, kind: Atom, pid: RawPid(m, r, k)) -> Effect(MonitorRef)

Establish a monitor on pid; the returned MonitorRef tags the DOWN message.

raw_name_register(m: Type, name: Atom, pid: RawPid(m, m, Plain)) -> Effect(Bool)

 fn raw_name_register(m: Type, name: Atom, pid: RawPid(m, m, Plain)) -> Effect(Bool)

── Name: typed process registration (the F-1 typed name → handle) ──

name_whereis returns a TYPED Option(RawPid(m,m,Plain)) — a sendable handle — instead of the untyped bare pid raw_whereis gives, closing F-1: the message type m rides on the caller's Std.Otp.Name(m) (the trust point, as in Gleam's Name(message)). Register/unregister are Bool-safe via the helper. AtomVM caveat: needs erlang:register/whereis; confirm support before relying on it there (host OTP is fine).

raw_name_unregister(name: Atom) -> Effect(Bool)

 fn raw_name_unregister(name: Atom) -> Effect(Bool)

Unregister name, returning true if it was registered and false otherwise.

raw_name_whereis(m: Type, name: Atom) -> Effect(Option(RawPid(m, m, Plain)))

 fn raw_name_whereis(m: Type, name: Atom) -> Effect(Option(RawPid(m, m, Plain)))

Look up name in the local registry as a typed Option(RawPid(m, m, Plain)).

raw_register(m: Type, r: Type, k: Type, name: Atom, pid: RawPid(m, r, k)) -> Effect(Bool)

 fn raw_register(m: Type, r: Type, k: Type, name: Atom, pid: RawPid(m, r, k)) -> Effect(Bool)

The registry operations deliberately remain raw and effect-typed. A higher layer may expose a name-indexed handle without asserting that a dynamic registry lookup is always successful.

register/unregister both answer the constant atom true — there is no failure they report by value (they raise instead).

raw_reply(r: Type, from: Tuple(RawPid(NoMessage, NoMessage, Plain), Ref), value: r) -> Effect(Atom)

 fn raw_reply(r: Type, from: Tuple(RawPid(NoMessage, NoMessage, Plain), Ref), value: r) -> Effect(Atom)

Reply explicitly to a gen_server caller. The public wrapper gives the callback-side from value a linear binder before consuming it.

raw_selector_new(p: Type) -> Selector(p)

 fn raw_selector_new(p: Type) -> Selector(p)

Create an empty Selector(p) with no registered subject handlers.

raw_selector_receive(p: Type, selector: Selector(p), timeout: Int) -> Effect(Option(p))

 fn raw_selector_receive(p: Type, selector: Selector(p), timeout: Int) -> Effect(Option(p))

Receive from whichever subject registered on selector delivers first within timeout ms, or None on timeout.

raw_selector_select_map(p: Type, m: Type, selector: Selector(p), subject: Tuple(RawPid(m, m, Plain), Ref), transform: Function(m, p)) -> Selector(p)

 fn raw_selector_select_map(p: Type, m: Type, selector: Selector(p), subject: Tuple(RawPid(m, m, Plain), Ref), transform: Function(m, p)) -> Selector(p)

Register subject on selector, mapping received messages via transform.

raw_self(m: Type) -> Effect(RawPid(m, m, Plain))

 fn raw_self(m: Type) -> Effect(RawPid(m, m, Plain))

The calling process's own pid. A process the VM spawned for us speaks no gen_server protocol, so the handle is Plain.

raw_send(m: Type, r: Type, k: Type, dest: RawPid(m, r, k), msg: m) -> Effect(m)

 fn raw_send(m: Type, r: Type, k: Type, dest: RawPid(m, r, k), msg: m) -> Effect(m)

Send msg to dest. Fire-and-forget; the effect is performing the send. Tag-polymorphic: a raw send to a gen_server is legitimate — it lands in handle_info. erlang:send/2 returns the MESSAGE, not ok.

raw_send_after(m: Type, r: Type, k: Type, delay: Int, pid: RawPid(m, r, k), msg: m) -> Effect(TimerRef)

 fn raw_send_after(m: Type, r: Type, k: Type, delay: Int, pid: RawPid(m, r, k), msg: m) -> Effect(TimerRef)

Schedule a message for a process and receive an opaque timer reference.

raw_server_call(m: Type, q: Type, r: Type, server: RawServerPid(m, q, r), req: q) -> Effect(r)

 fn raw_server_call(m: Type, q: Type, r: Type, server: RawServerPid(m, q, r), req: q) -> Effect(r)

Synchronous call against a RawServerPid actor via :gen_server.call/2.

raw_server_call_dep(m: Type, q: Type, kr: Type, res: Type, server: RawServerPid(m, q, kr), req: q) -> Effect(res)

 fn raw_server_call_dep(m: Type, q: Type, kr: Type, res: Type, server: RawServerPid(m, q, kr), req: q) -> Effect(res)

Dependent-reply synchronous call against a RawServerPid via :gen_server.call/2.

raw_server_cast(m: Type, q: Type, r: Type, server: RawServerPid(m, q, r), msg: m) -> Effect(Atom)

 fn raw_server_cast(m: Type, q: Type, r: Type, server: RawServerPid(m, q, r), msg: m) -> Effect(Atom)

Asynchronously cast msg to a RawServerPid actor via :gen_server.cast/2.

raw_server_stop(m: Type, q: Type, r: Type, pid: RawServerPid(m, q, r)) -> Effect(Atom)

 fn raw_server_stop(m: Type, q: Type, r: Type, pid: RawServerPid(m, q, r)) -> Effect(Atom)

Stop a RawServerPid actor via :gen_server.stop/1. Returns :ok.

raw_spawn(m: Type, thunk: Function(Unit)) -> Effect(RawPid(m, m, Plain))

 fn raw_spawn(m: Type, thunk: Function(Unit)) -> Effect(RawPid(m, m, Plain))

Spawn a new unlinked BEAM process executing thunk (:erlang.spawn/1).

raw_spawn_link(m: Type, thunk: Function(Unit)) -> Effect(RawPid(m, m, Plain))

 fn raw_spawn_link(m: Type, thunk: Function(Unit)) -> Effect(RawPid(m, m, Plain))

Spawn a new BEAM process linked to the caller (:erlang.spawn_link/1).

raw_start_link(a: Type, name: Tuple(Atom, Atom), module: Atom, args: a, opts: List(Atom)) -> Effect(Tuple)

 fn raw_start_link(a: Type, name: Tuple(Atom, Atom), module: Atom, args: a, opts: List(Atom)) -> Effect(Tuple)

Start a gen_server through its standard callback module. The raw return is deliberately the OTP {ok, pid}/error tuple; a behavior-specific wrapper narrows that contract after the callback context is established.

⚠ The return is typed Effect(Tuple), which is honest on AtomVM (whose gen_server init result is {ok, State} | {stop, Reason}) but NOT on OTP, where an init/1 returning ignore makes start_link return the BARE ATOM ignore. Typing that honestly means producing a TYPED handle from an untyped BEAM tuple — the same unfounded assertion as F-1, and deferred with it (audit §6). This applies to every op in the family below.

raw_statem_cast(event: Type, state: Type, data: Type, server: RawFsmPid(event, state, data), value: event) -> Effect(Atom)

 fn raw_statem_cast(event: Type, state: Type, data: Type, server: RawFsmPid(event, state, data), value: event) -> Effect(Atom)

Asynchronously cast value to a gen_statem (:gen_statem.cast/2).

raw_statem_start_link(a: Type, name: Tuple(Atom, Atom), module: Atom, args: a, opts: List(Atom)) -> Effect(Tuple)

 fn raw_statem_start_link(a: Type, name: Tuple(Atom, Atom), module: Atom, args: a, opts: List(Atom)) -> Effect(Tuple)

Start a gen_statem through its standard callback module. The raw return is deliberately the OTP {ok, pid}/error tuple; the transparent FSM macro supplies the behavior-specific callback contract.

raw_stop(q: Type, r: Type, pid: RawPid(q, r, Server)) -> Effect(Atom)

 fn raw_stop(q: Type, r: Type, pid: RawPid(q, r, Server)) -> Effect(Atom)

Stop a generic OTP process. The reason is intentionally polymorphic at this raw boundary; typed lifecycle wrappers choose the narrower reason type required by their behavior. Server-only, like the rest of the gen_server protocol. Returns the atom ok.

raw_subject_new(m: Type) -> Effect(Tuple(RawPid(m, m, Plain), Ref))

 fn raw_subject_new(m: Type) -> Effect(Tuple(RawPid(m, m, Plain), Ref))

── Subject: a typed message ADDRESS {owner_pid, tag_ref} (Gleam-style, F-1 addressing) ──

A subject is a fresh (pid, unique reference) pair. A send delivers {tag, message} to the owner's mailbox and a receive matches THAT tag, so one process may own several subjects of different message types and receive each independently — the decoupling Pid(m) (one message type per process) cannot give. The tagged receive … after … end is not a BIF, so these route through the Cure.Otp.Builtins runtime helper; Std.Otp narrows them into the typed Subject(m) surface. Ordinary effect discipline (each op is Effect).

raw_subject_receive(m: Type, subject: Tuple(RawPid(m, m, Plain), Ref), timeout: Int) -> Effect(Option(m))

 fn raw_subject_receive(m: Type, subject: Tuple(RawPid(m, m, Plain), Ref), timeout: Int) -> Effect(Option(m))

Receive the next message tagged for subject within timeout ms, or None.

raw_subject_send(m: Type, subject: Tuple(RawPid(m, m, Plain), Ref), message: m) -> Effect(Atom)

 fn raw_subject_send(m: Type, subject: Tuple(RawPid(m, m, Plain), Ref), message: m) -> Effect(Atom)

Send a tagged message to subject via Cure.Otp.Builtins.subject_send/2.

raw_supervisor_pid(index: Int, checked: Tuple(BarePid, Atom)) -> RawSupervisorPid

 fn raw_supervisor_pid(index: Int, checked: Tuple(BarePid, Atom)) -> RawSupervisorPid

Promote a validated BarePid to a RawSupervisorPid carrier.

raw_supervisor_start_link(a: Type, name: Tuple(Atom, Atom), module: Atom, args: List(a)) -> Effect(Tuple)

 fn raw_supervisor_start_link(a: Type, name: Tuple(Atom, Atom), module: Atom, args: List(a)) -> Effect(Tuple)

Start a named OTP supervisor via :supervisor.start_link/3.

raw_supervisor_stop(pid: RawSupervisorPid, reason: Atom, timeout: Int) -> Effect(Atom)

 fn raw_supervisor_stop(pid: RawSupervisorPid, reason: Atom, timeout: Int) -> Effect(Atom)

Stop a running supervisor via :gen_server.stop/3 with reason and timeout.

raw_term(a: Type, index: Int, boxed: Tuple(a, Atom)) -> RawTerm

 fn raw_term(a: Type, index: Int, boxed: Tuple(a, Atom)) -> RawTerm

Erase a statically typed value into a RawTerm by projecting it out of a tagged box via :erlang.element/2.

raw_term_atom(index: Int, checked: Tuple(RawTerm, Atom)) -> Atom

 fn raw_term_atom(index: Int, checked: Tuple(RawTerm, Atom)) -> Atom

Extract an Atom from a RawTerm after raw_term_is_atom succeeds.

raw_term_binary(index: Int, checked: Tuple(RawTerm, Atom)) -> Binary

 fn raw_term_binary(index: Int, checked: Tuple(RawTerm, Atom)) -> Binary

The guard that admits this extraction is raw_term_is_binary, so what comes out is a Binary — not a Cure String, which is nominal and erases to {String, code_points}. Std.Beam.decode_string decodes the binary.

raw_term_boolean(index: Int, checked: Tuple(RawTerm, Atom)) -> Bool

 fn raw_term_boolean(index: Int, checked: Tuple(RawTerm, Atom)) -> Bool

Extract a Bool from a RawTerm after raw_term_is_boolean succeeds.

raw_term_float(index: Int, checked: Tuple(RawTerm, Atom)) -> Float

 fn raw_term_float(index: Int, checked: Tuple(RawTerm, Atom)) -> Float

Extract a Float from a RawTerm after raw_term_is_float succeeds.

raw_term_integer(index: Int, checked: Tuple(RawTerm, Atom)) -> Int

 fn raw_term_integer(index: Int, checked: Tuple(RawTerm, Atom)) -> Int

Extract an Int from a RawTerm after raw_term_is_integer succeeds.

raw_term_is_atom(term: RawTerm) -> Bool

 fn raw_term_is_atom(term: RawTerm) -> Bool

Safe inbound observation floor. Predicates never refine by themselves; the representation-preserving projections below are used only after the corresponding predicate succeeds in Std.Beam.

raw_term_is_binary(term: RawTerm) -> Bool

 fn raw_term_is_binary(term: RawTerm) -> Bool

Return true if the erased RawTerm is a binary (:erlang.is_binary/1).

raw_term_is_boolean(term: RawTerm) -> Bool

 fn raw_term_is_boolean(term: RawTerm) -> Bool

Return true if the erased RawTerm is a boolean (:erlang.is_boolean/1).

raw_term_is_float(term: RawTerm) -> Bool

 fn raw_term_is_float(term: RawTerm) -> Bool

Return true if the erased RawTerm is a float (:erlang.is_float/1).

raw_term_is_integer(term: RawTerm) -> Bool

 fn raw_term_is_integer(term: RawTerm) -> Bool

Return true if the erased RawTerm is an integer (:erlang.is_integer/1).

raw_term_is_pid(term: RawTerm) -> Bool

 fn raw_term_is_pid(term: RawTerm) -> Bool

Return true if the erased RawTerm is a BEAM PID (:erlang.is_pid/1).

raw_term_is_tuple(term: RawTerm) -> Bool

 fn raw_term_is_tuple(term: RawTerm) -> Bool

Return true if the erased RawTerm is a BEAM tuple (:erlang.is_tuple/1).

raw_term_pid(index: Int, checked: Tuple(RawTerm, Atom)) -> BarePid

 fn raw_term_pid(index: Int, checked: Tuple(RawTerm, Atom)) -> BarePid

Extract a BarePid from a RawTerm after raw_term_is_pid succeeds.

raw_term_tuple_element(index: Int, term: RawTerm) -> RawTerm

 fn raw_term_tuple_element(index: Int, term: RawTerm) -> RawTerm

Project the 1-based index-th element from a checked tuple RawTerm.

raw_term_tuple_size(term: RawTerm) -> Int

 fn raw_term_tuple_size(term: RawTerm) -> Int

Return the arity of a RawTerm previously checked with raw_term_is_tuple.

raw_unlink(m: Type, r: Type, k: Type, pid: RawPid(m, r, k)) -> Effect(Bool)

 fn raw_unlink(m: Type, r: Type, k: Type, pid: RawPid(m, r, k)) -> Effect(Bool)

Remove a link between the calling process and pid (:erlang.unlink/1).

raw_unregister(name: Atom) -> Effect(Bool)

 fn raw_unregister(name: Atom) -> Effect(Bool)

Remove the local registration for name (:erlang.unregister/1).

raw_whereis(name: Atom) -> Effect(BarePid | :undefined)

 fn raw_whereis(name: Atom) -> Effect(BarePid | :undefined)

whereis returns the bare atom undefined when the name is not registered — that is the BIF's real contract, and typing it as a pid would let a well-typed handle BE the atom undefined. The FFI boundary re-tags the union: :undefined by exact value, the pid by the is_pid guard @erases(:pid) declares. Std.Otp.whereis turns that into an Option.