Std. Otp
(Cure Standard Library v0.37.2)
View Source
Public names for the sealed raw carriers used by this module's signatures.
These aliases make the Std.Otp interface self-contained without leaking
every bare name imported from Std.Otp.Raw into downstream modules.
Examples
use Std.Otp
let ping = message_code(:ping, 0)
let pong = message_code(:pong, 1)
let protocol = union(ping, pong)
handles(protocol, :ping, 0) # => true
subset(ping, protocol) # => trueuse Std.Otp
use Std.Option
fn roundtrip() -> Effect(Option(Int)) =
let subj: Subject(Int) = new_subject()
let _ = subject_send(subj, 42)
subject_receive(subj, 1000)
Summary
Types
An actor-like server has independent asynchronous and synchronous input codes. All three indices are erased; the runtime value is the native pid.
Typed lifecycle and observation wrappers over the raw effect boundary. MonitorRef
and TimerRef are the raw base's own DISTINCT carriers (imported, not aliased): they
used to be two names for one Ref, which made cancel_timer(monitor_ref) well-typed.
A DEPENDENT gen_server handle: requests q, reply computed PER REQUEST by rep : q -> Type (an
ReplyOf). The SAME server answers different requests at different reply types. A real datatype INDEXED by
rep (mirroring Std.Sigma), so call_dep recovers the reply family from the handle — a phantom typealias
could not. Wraps the raw server pid and shares its bare-pid representation.
Typed handle for a generated finite-state machine. state and data are
phantom observations; event is the only asynchronously accepted code.
A typed gen_server taking requests q, replying r. DISTINCT from Pid(m):
call/cast/stop are gen_server protocol operations, and a plain spawned process
cannot answer them — it would block the caller for 5s and then exit it. The Plain
/ Server tag is a phantom at kind Type: no values, no runtime cost.
A process message set. The first algebra floor stores tag and arity shapes; typed ADT payload derivation is added by the transparent macro phase once callback syntax is available.
A typed process NAME (Gleam-style Name(m)) — a registered atom carrying the message type m its process
accepts. Registering binds a Pid(m) to the name; whereis_name looks it up as a TYPED, sendable
Option(Pid(m)) — closing F-1 (a name lookup previously yielded only an untyped, unsendable BarePid). The
type m is the caller's claim, carried by the Name (the sole trust point, as in Gleam). AtomVM caveat:
uses erlang:register/whereis — host OTP is fine; confirm AtomVM support before relying on it there.
The typed BEAM process algebra — the sanctioned concurrency surface.
The callback-side one-shot reply capability supplied by gen_server. It
erases to OTP's {pid, tag} tuple but remains linear at Cure call sites.
A typed message ADDRESS — the Gleam-style Subject. A fresh (owner-pid, unique-tag) pair; UNLIKE Pid(m)
(one message type per process) a single process may own SEVERAL subjects of different types, each a distinct
typed channel. subject_send delivers a TAGGED message to the owner; subject_receive matches that tag, so
channels never cross. Erases to the bare {pid, ref} tuple — no registry / persistent_term (AtomVM-safe).
This is the addressing layer Selector (typed selective receive) and typed Name build on.
Typed handle to an OTP supervisor. The carrier is a bare native pid, but it is not interchangeable with an actor, FSM, or freely sendable process.
Functions
Melquiades is ordinary operator sugar over the checked operation above.
Both spellings have exactly tell's indexed message check and effect result;
neither restores the retired raw-process send node.
Perform a synchronous request q against a running ActorServer and wait
for a reply of type r.
Perform a synchronous dependent request q against a DepActorServer and
wait for a reply typed at rep(request).
Send an asynchronous message of type m to a running ActorServer.
Stop a running ActorServer.
View a running gen_server as a dependent server under a chosen reply family rep (from the expected
result type). Zero runtime content beyond the wrapped pid.
View a running ActorServer as a dependent actor server under a chosen
request-indexed reply family rep.
Synchronous gen_server call: send request q, block for reply r. Both the
request AND the reply are checked against the server's type.
Synchronous dependent gen_server call: send request and block for the
reply at the request's own type rep(request). Same partiality caveat as
call.
Cancel a timer, surfacing what the BIF actually reports: Some(ms) when the timer
was still pending (ms milliseconds were left on it), None when it had already
fired or been cancelled. The old Effect(Unit) threw that answer away, which is how
a caller could believe a cancellation succeeded when it had not.
Asynchronous gen_server cast — a typed fire-and-forget request (no reply).
gen_server:cast/2 answers the constant atom ok; the wrapper discards it.
Remove a monitor AND flush any DOWN already sitting in the mailbox. Without flush
a stale DOWN outlives the call, and every receiving match has to carry an arm for
a monitor the caller believes it already removed.
Send an asynchronous message of type m to a running DepActorServer.
Stop a running DepActorServer.
Synchronous DEPENDENT gen_server call: send request, block for the reply at the request's OWN type
rep(request). The dependent counterpart of call — one server answers heterogeneous requests, each at its
own reply type, checked at the call site. rep(request) is fixed by the EXPLICIT request argument (not a
return-only implicit), so it threads through the extern. Same PARTIAL caveat as call.
Project the wrapped raw pid (constant, non-Effect motive so the dependent match is trivial).
Send an exit signal. Makes NO type-level claim that the target dies — correctly: which of the three outcomes occurs depends on the target's trap_exit flag, which the sender cannot see. A polymorphic reason could not even state the distinction.
Why a process is being asked to exit. The BEAM's three exit rules turn on exactly this distinction, crossed with the target's trap_exit flag and the signal's link flag
Asynchronously cast a typed event to a running finite-state machine.
Does code accept a message tag with the given payload arity?
Check whether the process identified by pid is currently alive on the local
node.
erlang:link/1, unlink/1 and register/2 all answer the constant true — there is
no failure they report by value (they raise instead). The wrappers discard it.
Transform the handle inside a Started result while preserving failure and
ignore outcomes.
A single message shape constructor, convenient for macro-generated codes.
Establish a monitor of the given MonitorKind on pid and return its
MonitorRef.
A typed name over a registered atom. m asserts what the named process accepts.
Typed SELECTIVE RECEIVE (Gleam-style Selector). Accumulate handlers over several subjects of DIFFERENT
message types — each mapped into a common payload p by select_map — then selector_receive returns
whichever arrives first, typed as p. select is the identity case (the subject's messages ARE the
payload). Building a selector is pure; only the receive is an Effect.
Mint a fresh subject owned by the calling process.
Register pid locally under the atom name.
Register a Pid(m) under the name. Returns whether registration succeeded (false if the name is taken).
Send one reply through a callback's linear from capability. Generated
actor callbacks use this direct operation and return noreply.
Add a subject whose message type IS the payload (identity mapping).
Add subject, mapping its messages into the selector's payload p.
Receive from whichever selected subject arrives first within timeout ms; None on timeout.
The calling process's own typed pid; the erased message index is supplied by the enclosing expected result at each use site.
The signal-layer operations below accept BOTH handles: linking, monitoring,
exiting, naming and timing are properties of a BEAM PROCESS, not of the protocol
it speaks. They are tag-polymorphic in k.
Spawn a nullary process function and return its indexed handle.
Spawn and link a nullary process function to the calling process.
Start a checked actor callback module and decode OTP's heterogeneous result.
Only the :ok branch may attach actor protocol indices, and only after the
second tuple element has passed the native PID guard.
Start a checked finite-state machine callback module and decode OTP's startup
result into StartResult(FsmPid(event, state, data)).
Start a gen_server callback module. The generic floor preserves OTP's result tuple; transparent behavior macros provide the typed specialization.
Start an unnamed gen_statem callback module and return OTP's raw start tuple.
Start a locally registered OTP supervisor module with empty initialization arguments.
Start a locally registered OTP supervisor module with explicit initialization arguments.
Start a locally registered OTP supervisor module and decode OTP's startup
result into StartResult(SupervisorHandle).
Stop a gen_server. Server-only — gen_server:stop on a plain process blocks
and then exits the caller. The BIF answers the constant atom ok; discarded.
Stop a running supervisor with the given ExitReason (using a 5000 ms timeout).
Receive the next message addressed to subject within timeout ms; None on timeout. Only the subject's
OWNER (the process that created it) may receive.
Send a typed message to a subject — delivered TAGGED to the owner's mailbox (fire-and-forget, like tell).
Is every shape in narrow also accepted by wide?
Send a well-typed message: msg : m must match dest's accepted type m,
so a Pid(Command) can never be sent a Telemetry. (Named tell, not
send: the Melquiades operators below provide the compact send surface.)
Union two codes, preserving the first code's order and removing duplicate tag/arity shapes from the second code.
Remove an existing process link between the calling process and pid.
Remove the local process registration for name.
Remove the name's registration. Returns whether it was registered.
Look up a registered name. None when the name is not registered — the BIF returns
the atom undefined there, and the old signature asserted a pid.
Look up the process registered under the name as a TYPED, sendable Pid(m); None if unregistered.
Unicode Melquiades operator alias for tell: send a well-typed message msg
to dest.
Types
type ActorServer(m, q, r)
An actor-like server has independent asynchronous and synchronous input codes. All three indices are erased; the runtime value is the native pid.
type BarePid
type BeamTerm
Typed lifecycle and observation wrappers over the raw effect boundary. MonitorRef
and TimerRef are the raw base's own DISTINCT carriers (imported, not aliased): they
used to be two names for one Ref, which made cancel_timer(monitor_ref) well-typed.
type DepActorServer(m, q, rep)
type DepGenServer(q, rep) indices ()
mk_dep_server : (raw: RawPid(q, Unit, Server)) -> DepGenServer(q, rep)
A DEPENDENT gen_server handle: requests q, reply computed PER REQUEST by rep : q -> Type (an
ReplyOf). The SAME server answers different requests at different reply types. A real datatype INDEXED by
rep (mirroring Std.Sigma), so call_dep recovers the reply family from the handle — a phantom typealias
could not. Wraps the raw server pid and shares its bare-pid representation.
type FsmPid(event, state, data)
Typed handle for a generated finite-state machine. state and data are
phantom observations; event is the only asynchronously accepted code.
type GenServer(q, r)
A typed gen_server taking requests q, replying r. DISTINCT from Pid(m):
call/cast/stop are gen_server protocol operations, and a plain spawned process
cannot answer them — it would block the caller for 5s and then exit it. The Plain
/ Server tag is a phantom at kind Type: no values, no runtime cost.
enum MessageCode
Empty
Shape
A process message set. The first algebra floor stores tag and arity shapes; typed ADT payload derivation is added by the transparent macro phase once callback syntax is available.
type MonitorRef
type Name(m) indices ()
MkName : (registered: Atom) -> Name(m)
A typed process NAME (Gleam-style Name(m)) — a registered atom carrying the message type m its process
accepts. Registering binds a Pid(m) to the name; whereis_name looks it up as a TYPED, sendable
Option(Pid(m)) — closing F-1 (a name lookup previously yielded only an untyped, unsendable BarePid). The
type m is the caller's claim, carried by the Name (the sole trust point, as in Gleam). AtomVM caveat:
uses erlang:register/whereis — host OTP is fine; confirm AtomVM support before relying on it there.
type NoMessage
type Pid(m)
The typed BEAM process algebra — the sanctioned concurrency surface.
Two typed handles, both opaque phantoms erased to a raw erlang:pid() at
runtime; their whole job is static — using a process at the WRONG message or
reply type is a COMPILE error, the guarantee Std.Otp.Raw's untyped Pid
cannot give (design 2026-07-10-checked-beam-concurrency §2,
2026-07-09-typed-beam-process-algebra):
Pid(m)— a plain process accepting messages of typem(raw `erlang:send`, one-way).GenServer(q, r)— agen_servertaking requestsq; a synchronous`call` returns a reply `r`. The reply type rides on the SERVER'S type, so `call` needs no return-only implicit (which does not resolve through an effectful extern) — a wrong request AND a wrong reply are both caught.
Every operation performs a BEAM side effect, so it returns Effect(T). The effect
discipline forbids duplicating, dropping, or reordering an OPERATION — a statement
about the PROGRAM'S EFFECT SEQUENCE, not about the mailbox. The BEAM promises no
delivery at all (a tell to a dead process silently succeeds) and orders signals only
PAIRWISE, from one sender to one target; nothing in this module claims more. Messages
are POLYMORPHIC (the narrow point for a message set), never Any.
The typed layer calls the raw externs through ordinary qualified Cure
definitions. The only foreign declarations are in Std.Otp.Raw; the
imported opaque carrier preserves erased runtime identity while the public
aliases below attach message and request/reply indices.
A typed handle to a plain BEAM process accepting messages of type m. It answers
raw sends, and nothing else.
type Plain
type RawDepServerPid(m, q, rep)
type RawFsmPid(event, state, data)
type RawPid(m, r, k)
type RawServerPid(m, q, r)
type RawSupervisorPid
type RawTerm
type Ref
type Reply(r)
The callback-side one-shot reply capability supplied by gen_server. It
erases to OTP's {pid, tag} tuple but remains linear at Cure call sites.
type Selector(p)
type Server
enum StartResult
Started
StartFailed
StartIgnored
InvalidStartResult
type Subject(m)
A typed message ADDRESS — the Gleam-style Subject. A fresh (owner-pid, unique-tag) pair; UNLIKE Pid(m)
(one message type per process) a single process may own SEVERAL subjects of different types, each a distinct
typed channel. subject_send delivers a TAGGED message to the owner; subject_receive matches that tag, so
channels never cross. Erases to the bare {pid, ref} tuple — no registry / persistent_term (AtomVM-safe).
This is the addressing layer Selector (typed selective receive) and typed Name build on.
type SupervisorHandle
Typed handle to an OTP supervisor. The carrier is a bare native pid, but it is not interchangeable with an actor, FSM, or freely sendable process.
type TimerRef
Functions
fn <-|(m: Type, r: Type, k: Type, dest: RawPid(m, r, k), msg: m) -> Effect(Unit)
Melquiades is ordinary operator sugar over the checked operation above.
Both spellings have exactly tell's indexed message check and effect result;
neither restores the retired raw-process send node.
fn actor_call(m: Type, q: Type, r: Type, server: ActorServer(m, q, r), request: q) -> Effect(r)
Perform a synchronous request q against a running ActorServer and wait
for a reply of type r.
fn actor_call_dep(m: Type, q: Type, rep: Function(q, Type), server: DepActorServer(m, q, rep), request: q) -> Effect(rep(request))
Perform a synchronous dependent request q against a DepActorServer and
wait for a reply typed at rep(request).
fn actor_cast(m: Type, q: Type, r: Type, server: ActorServer(m, q, r), message: m) -> Effect(Unit)
Send an asynchronous message of type m to a running ActorServer.
fn actor_stop(m: Type, q: Type, r: Type, server: ActorServer(m, q, r)) -> Effect(Unit)
Stop a running ActorServer.
fn as_dep(q: Type, rep: Function(q, Type), server: GenServer(q, Unit)) -> DepGenServer(q, rep)
View a running gen_server as a dependent server under a chosen reply family rep (from the expected
result type). Zero runtime content beyond the wrapped pid.
fn as_dep_actor(m: Type, q: Type, rep: Function(q, Type), server: ActorServer(m, q, Unit)) -> DepActorServer(m, q, rep)
View a running ActorServer as a dependent actor server under a chosen
request-indexed reply family rep.
fn call(q: Type, r: Type, server: GenServer(q, r), request: q) -> Effect(r)
Synchronous gen_server call: send request q, block for reply r. Both the
request AND the reply are checked against the server's type.
⚠ PARTIAL. On timeout (default 5000 ms) or server death the CALLER EXITS. Effect(r)
is sound — no value is ever returned at the wrong type — but it is NOT total: there is
simply no continuation. A try_call reifying the failure as a value needs a try/catch
shim and is deferred (audit §6).
fn call_dep(q: Type, rep: Function(q, Type), server: DepGenServer(q, rep), request: q) -> Effect(rep(request))
Synchronous dependent gen_server call: send request and block for the
reply at the request's own type rep(request). Same partiality caveat as
call.
fn cancel_timer(ref: TimerRef) -> Effect(Option(Int))
Cancel a timer, surfacing what the BIF actually reports: Some(ms) when the timer
was still pending (ms milliseconds were left on it), None when it had already
fired or been cancelled. The old Effect(Unit) threw that answer away, which is how
a caller could believe a cancellation succeeded when it had not.
⚠ AtomVM: erlang:send_after/3 registers its timer under a DIFFERENT ref than the one
it returns (timer_manager.erl:87-91), so on AtomVM cancelling a send_after ref always
yields None AND THE MESSAGE STILL FIRES. Cancellation is reliable on OTP; on AtomVM it
is not. See the audit, §5.
fn cast(q: Type, r: Type, server: GenServer(q, r), request: q) -> Effect(Unit)
Asynchronous gen_server cast — a typed fire-and-forget request (no reply).
gen_server:cast/2 answers the constant atom ok; the wrapper discards it.
fn decode_actor_start(m: Type, q: Type, r: Type, outcome: BeamTerm) -> StartResult(ActorServer(m, q, r))
fn decode_actor_start_pair(m: Type, q: Type, r: Type, outcome: BeamTerm) -> StartResult(ActorServer(m, q, r))
fn decode_actor_start_tuple(m: Type, q: Type, r: Type, outcome: BeamTerm) -> StartResult(ActorServer(m, q, r))
fn decode_fsm_start(event: Type, state: Type, data: Type, outcome: BeamTerm) -> StartResult(FsmPid(event, state, data))
fn decode_started_actor(m: Type, q: Type, r: Type, outcome: BeamTerm) -> StartResult(ActorServer(m, q, r))
fn decode_started_fsm(event: Type, state: Type, data: Type, outcome: BeamTerm) -> StartResult(FsmPid(event, state, data))
fn decode_started_supervisor(outcome: BeamTerm) -> StartResult(SupervisorHandle)
fn decode_supervisor_start(outcome: BeamTerm) -> StartResult(SupervisorHandle)
fn demonitor(ref: MonitorRef) -> Effect(Unit)
Remove a monitor AND flush any DOWN already sitting in the mailbox. Without flush
a stale DOWN outlives the call, and every receiving match has to carry an arm for
a monitor the caller believes it already removed.
fn dep_actor_cast(m: Type, q: Type, rep: Function(q, Type), server: DepActorServer(m, q, rep), message: m) -> Effect(Unit)
Send an asynchronous message of type m to a running DepActorServer.
fn dep_actor_raw(m: Type, q: Type, rep: Function(q, Type), server: DepActorServer(m, q, rep)) -> RawServerPid(m, q, Unit)
fn dep_actor_stop(m: Type, q: Type, rep: Function(q, Type), server: DepActorServer(m, q, rep)) -> Effect(Unit)
Stop a running DepActorServer.
fn dep_raw(q: Type, rep: Function(q, Type), server: DepGenServer(q, rep)) -> RawPid(q, Unit, Server)
Synchronous DEPENDENT gen_server call: send request, block for the reply at the request's OWN type
rep(request). The dependent counterpart of call — one server answers heterogeneous requests, each at its
own reply type, checked at the call site. rep(request) is fixed by the EXPLICIT request argument (not a
return-only implicit), so it threads through the extern. Same PARTIAL caveat as call.
Project the wrapped raw pid (constant, non-Effect motive so the dependent match is trivial).
fn exit(m: Type, r: Type, k: Type, pid: RawPid(m, r, k), reason: ExitReason) -> Effect(Unit)
Send an exit signal. Makes NO type-level claim that the target dies — correctly: which of the three outcomes occurs depends on the target's trap_exit flag, which the sender cannot see. A polymorphic reason could not even state the distinction.
fn exit_atom(reason: ExitReason) -> Atom
Why a process is being asked to exit. The BEAM's three exit rules turn on exactly this distinction, crossed with the target's trap_exit flag and the signal's link flag:
Normal— dropped by a non-trapping target (unless it is the calleritself, which does terminate).Kill— untrappable when sent explicitly withexit/2: the target diesand propagates the reason `killed`. (Sent THROUGH A LINK it is trappable — but this op only ever sends explicitly.)Because(reason)— terminates a non-trapping target; a trapping target receives`{'EXIT', From, reason}` at the END of its mailbox.
fn fsm_send(event: Type, state: Type, data: Type, machine: FsmPid(event, state, data), value: event) -> Effect(Unit)
Asynchronously cast a typed event to a running finite-state machine.
fn handles(code: MessageCode, tag: Atom, arity: Int) -> Bool
Does code accept a message tag with the given payload arity?
fn is_alive(m: Type, r: Type, k: Type, pid: RawPid(m, r, k)) -> Effect(Bool)
Check whether the process identified by pid is currently alive on the local
node.
fn link(m: Type, r: Type, k: Type, pid: RawPid(m, r, k)) -> Effect(Unit)
erlang:link/1, unlink/1 and register/2 all answer the constant true — there is
no failure they report by value (they raise instead). The wrappers discard it.
fn map_start(a: Type, b: Type, result: StartResult(a), convert: Function(a, b)) -> StartResult(b)
Transform the handle inside a Started result while preserving failure and
ignore outcomes.
fn message_code(tag: Atom, arity: Int) -> MessageCode
A single message shape constructor, convenient for macro-generated codes.
fn monitor(m: Type, r: Type, k: Type, kind: MonitorKind, pid: RawPid(m, r, k)) -> Effect(MonitorRef)
Establish a monitor of the given MonitorKind on pid and return its
MonitorRef.
fn name(m: Type, registered: Atom) -> Name(m)
A typed name over a registered atom. m asserts what the named process accepts.
fn name_atom(m: Type, n: Name(m)) -> Atom
fn new_selector(p: Type) -> Selector(p)
Typed SELECTIVE RECEIVE (Gleam-style Selector). Accumulate handlers over several subjects of DIFFERENT
message types — each mapped into a common payload p by select_map — then selector_receive returns
whichever arrives first, typed as p. select is the identity case (the subject's messages ARE the
payload). Building a selector is pure; only the receive is an Effect.
fn new_subject(m: Type) -> Effect(Subject(m))
Mint a fresh subject owned by the calling process.
fn register(m: Type, r: Type, k: Type, name: Atom, pid: RawPid(m, r, k)) -> Effect(Unit)
Register pid locally under the atom name.
fn register_name(m: Type, n: Name(m), pid: Pid(m)) -> Effect(Bool)
Register a Pid(m) under the name. Returns whether registration succeeded (false if the name is taken).
fn remove_shape(code: MessageCode, tag: Atom, arity: Int) -> MessageCode
fn reply(r: Type, from: Reply(r), value: r) -> Effect(Unit)
Send one reply through a callback's linear from capability. Generated
actor callbacks use this direct operation and return noreply.
fn same_shape(left_tag: Atom, left_arity: Int, right_tag: Atom, right_arity: Int) -> Bool
fn select(p: Type, selector: Selector(p), subject: Subject(p)) -> Selector(p)
Add a subject whose message type IS the payload (identity mapping).
fn select_map(p: Type, m: Type, selector: Selector(p), subject: Subject(m), transform: Function(m, p)) -> Selector(p)
Add subject, mapping its messages into the selector's payload p.
fn selector_receive(p: Type, selector: Selector(p), timeout: Int) -> Effect(Option(p))
Receive from whichever selected subject arrives first within timeout ms; None on timeout.
fn self(m: Type) -> Effect(Pid(m))
The calling process's own typed pid; the erased message index is supplied by the enclosing expected result at each use site.
fn send_after(m: Type, r: Type, k: Type, delay: Int, pid: RawPid(m, r, k), msg: m) -> Effect(TimerRef)
The signal-layer operations below accept BOTH handles: linking, monitoring,
exiting, naming and timing are properties of a BEAM PROCESS, not of the protocol
it speaks. They are tag-polymorphic in k.
fn spawn(m: Type, thunk: Function(Unit)) -> Effect(Pid(m))
Spawn a nullary process function and return its indexed handle.
fn spawn_link(m: Type, thunk: Function(Unit)) -> Effect(Pid(m))
Spawn and link a nullary process function to the calling process.
fn start_actor(a: Type, m: Type, q: Type, r: Type, module: Atom, args: a) -> Effect(StartResult(ActorServer(m, q, r)))
Start a checked actor callback module and decode OTP's heterogeneous result.
Only the :ok branch may attach actor protocol indices, and only after the
second tuple element has passed the native PID guard.
fn start_fsm(a: Type, event: Type, state: Type, data: Type, module: Atom, args: a) -> Effect(StartResult(FsmPid(event, state, data)))
Start a checked finite-state machine callback module and decode OTP's startup
result into StartResult(FsmPid(event, state, data)).
fn start_link(a: Type, module: Atom, args: a) -> Effect(Tuple)
Start a gen_server callback module. The generic floor preserves OTP's result tuple; transparent behavior macros provide the typed specialization.
fn start_statem(a: Type, module: Atom, args: a) -> Effect(Tuple)
Start an unnamed gen_statem callback module and return OTP's raw start tuple.
fn start_supervisor(module: Atom) -> Effect(Tuple)
Start a locally registered OTP supervisor module with empty initialization arguments.
fn start_supervisor_with(a: Type, module: Atom, args: List(a)) -> Effect(Tuple)
Start a locally registered OTP supervisor module with explicit initialization arguments.
fn start_typed_supervisor(module: Atom) -> Effect(StartResult(SupervisorHandle))
Start a locally registered OTP supervisor module and decode OTP's startup
result into StartResult(SupervisorHandle).
fn stop(q: Type, r: Type, server: GenServer(q, r)) -> Effect(Unit)
Stop a gen_server. Server-only — gen_server:stop on a plain process blocks
and then exits the caller. The BIF answers the constant atom ok; discarded.
fn stop_supervisor(supervisor: SupervisorHandle, reason: ExitReason) -> Effect(Unit)
Stop a running supervisor with the given ExitReason (using a 5000 ms timeout).
fn subject_receive(m: Type, subject: Subject(m), timeout: Int) -> Effect(Option(m))
Receive the next message addressed to subject within timeout ms; None on timeout. Only the subject's
OWNER (the process that created it) may receive.
fn subject_send(m: Type, subject: Subject(m), message: m) -> Effect(Unit)
Send a typed message to a subject — delivered TAGGED to the owner's mailbox (fire-and-forget, like tell).
fn subset(narrow: MessageCode, wide: MessageCode) -> Bool
Is every shape in narrow also accepted by wide?
fn tell(m: Type, r: Type, k: Type, dest: RawPid(m, r, k), msg: m) -> Effect(Unit)
Send a well-typed message: msg : m must match dest's accepted type m,
so a Pid(Command) can never be sent a Telemetry. (Named tell, not
send: the Melquiades operators below provide the compact send surface.)
Accepts BOTH handles: a raw send to a gen_server is legitimate BEAM practice —
it lands in handle_info.
The raw BIF returns the message itself; the typed wrapper DISCARDS it — a send is
fire-and-forget, and echoing the argument back tells the caller nothing. Discarding
is a choice the typed layer makes explicitly, not a lie the raw type tells.
fn union(left: MessageCode, right: MessageCode) -> MessageCode
Union two codes, preserving the first code's order and removing duplicate tag/arity shapes from the second code.
fn unlink(m: Type, r: Type, k: Type, pid: RawPid(m, r, k)) -> Effect(Unit)
Remove an existing process link between the calling process and pid.
fn unregister(name: Atom) -> Effect(Unit)
Remove the local process registration for name.
fn unregister_name(m: Type, n: Name(m)) -> Effect(Bool)
Remove the name's registration. Returns whether it was registered.
fn whereis(name: Atom) -> Effect(Option(BarePid))
Look up a registered name. None when the name is not registered — the BIF returns
the atom undefined there, and the old signature asserted a pid.
The result is a BarePid: you may link, monitor, exit or is_alive it, but you
cannot tell to it. Nothing associates a registered NAME with a message TYPE, so a
typed handle cannot be recovered from one (audit F-1 / parent spec §13.7).
fn whereis_name(m: Type, n: Name(m)) -> Effect(Option(Pid(m)))
Look up the process registered under the name as a TYPED, sendable Pid(m); None if unregistered.
fn ✉(m: Type, r: Type, k: Type, dest: RawPid(m, r, k), msg: m) -> Effect(Unit)
Unicode Melquiades operator alias for tell: send a well-typed message msg
to dest.