class

Spacetime::SATS::AlgebraicValue

Inherits Reference < Object

Dynamic value representation for any SATS AlgebraicType.

Supports schema-guided BSATN encoding/decoding, SATS-JSON conversion, SATN human-readable formatting, and structural type checking.

Constructors

array(elems : Array(AlgebraicValue)) : self
Source
bool(val : Bool) : self
Source
bytes(slice : Bytes) : self
Source
connection_id(cid : ConnectionId) : self
Source
decode_bsatn(ty : AlgebraicType, decoder : BSATN::Decoder, typespace : Typespace | Nil = nil) : self

Decodes an AlgebraicValue from BSATN guided by ty and typespace.

Source
f32(val : Float32) : self
Source
f64(val : Float64) : self
Source
from_sats_json(ty : AlgebraicType, any : JSON::Any, typespace : Typespace | Nil = nil) : self

Parses a SATS-JSON JSON::Any into an AlgebraicValue guided by ty and typespace.

Source
i128(val : Int128) : self
Source
i16(val : Int16) : self
Source
i256(val : I256) : self
Source
i32(val : Int32) : self
Source
i64(val : Int64) : self
Source
i8(val : Int8) : self
Source
identity(id : Identity) : self
Source
new(tag : AlgebraicType::Tag, raw : RawPayload)
Source
none
Source
product(val : ProductValue) : self
Source
product(elements : Array(AlgebraicValue)) : self
Source
some(inner : AlgebraicValue) : self
Source
string(val : String) : self
Source
sum(tag : UInt8, value : AlgebraicValue = unit) : self
Source
time_duration(dur : TimeDuration) : self
Source
timestamp(ts : Timestamp) : self
Source
u128(val : UInt128) : self
Source
u16(val : UInt16) : self
Source
u256(val : U256) : self
Source
u32(val : UInt32) : self
Source
u64(val : UInt64) : self
Source
u8(val : UInt8) : self
Source
unit
Source

Instance methods

==(other : AlgebraicValue) : Bool
Source
as_array
Source
as_bool
Source
as_bytes
Source
as_f32
Source
as_f64
Source
as_i128
Source
as_i16
Source
as_i256
Source
as_i32
Source
as_i64
Source
as_i8
Source
as_product

Typed accessors

Source
as_string
Source
as_sum
Source
as_u128
Source
as_u16
Source
as_u256
Source
as_u32
Source
as_u64
Source
as_u8
Source
encode_bsatn(encoder : BSATN::Encoder) : Nil

Encodes this AlgebraicValue into BSATN.

Source
to_satn(ty : AlgebraicType | Nil = nil, typespace : Typespace | Nil = nil) : String

Formats this value in SATN (Spacetime Algebraic Type Notation) human-readable syntax.

Source
to_sats_json(ty : AlgebraicType, json : JSON::Builder, typespace : Typespace | Nil = nil) : Nil

Serializes this AlgebraicValue to SATS-JSON guided by ty and typespace.

Source
to_sats_json(ty : AlgebraicType, typespace : Typespace | Nil = nil) : String
Source
type_check?(ty : AlgebraicType, typespace : Typespace | Nil = nil) : Bool

Checks whether this value conforms structurally to ty within typespace.

Source

Nested types