Std.Beam
View source →Opaque native term at the foreign boundary. It can be passed to trusted primitives, but ordinary Cure code cannot inspect it or claim a type for it.
Types
-
type BeamTerm -
type EncodedTerm -
type BarePid -
type BeamDecodeErrorWhy an inbound BEAM term could not be validated as the requested Cure type. Decoding is deliberately separate from encoding: outbound conversion is total, while a foreign term may have any tag or payload shape.
Functions
-
# fn adt_arity(term: BeamTerm) -> Option(Int)
-
# fn adt_tag(term: BeamTerm) -> Option(Atom)
Native ADTs use an atom for a nullary constructor and a tuple whose first element is the constructor atom otherwise. These observations expose only the validated tag and field count; structural decoders still validate and reconstruct every field before producing a typed value.
-
# fn atom(term: BeamTerm) -> Option(Atom)
Total inbound observations. A projection is performed only after its BEAM guard succeeds, so no unvalidated RawTerm is claimed as a Cure value.
-
# fn decode_atom(term: BeamTerm) -> Result(Atom, BeamDecodeError)
-
# fn decode_bool(term: BeamTerm) -> Result(Bool, BeamDecodeError)
-
# fn decode_float(term: BeamTerm) -> Result(Float, BeamDecodeError)
-
# fn decode_int(term: BeamTerm) -> Result(Int, BeamDecodeError)
-
# fn decode_pid(term: BeamTerm) -> Result(BarePid, BeamDecodeError)
-
# fn decode_string(term: BeamTerm) -> Result(String, BeamDecodeError)
A BEAM binary is not a Cure
String:Stringis nominal and erases to{String, code_points}. Decode the UTF-8 binary into its code points and rebuild the nominal value, rather than relabelling the binary. -
# fn forget(a: Type, value: a) -> BeamTerm
The primitive boundary used by derived and hand-written encoders.
raw_termis an erasing identity at runtime; the tuple merely prevents an unconstrained polymorphic extern from manufacturingRawTermin Core. -
# fn pid(term: BeamTerm) -> Option(BarePid)
-
# fn tuple_arity(term: BeamTerm) -> Option(Int)
-
# fn tuple_element(term: BeamTerm, index: Int) -> Option(BeamTerm)
Zero-based checked tuple access for Cure callers; Erlang's element/2 is one-based. Negative and out-of-range indices return None.