pub enum Type {
Int,
Float,
Bool,
String,
Symbol,
Channel,
Socket,
Quotation(Box<Effect>),
Closure {
effect: Box<Effect>,
captures: Vec<Type>,
},
Union(String),
Variant,
Var(String),
}Expand description
Base types in the language
Variants§
Int
Integer type
Float
Floating-point type (IEEE 754 double precision)
Bool
Boolean type
String
String type
Symbol
Symbol type (interned identifier for dynamic variant construction) Syntax: :foo, :some-name
Channel
Channel type (for CSP-style concurrency) Channels are reference-counted handles - dup increments refcount
Socket
Socket type (TCP/UDP file descriptor — phantom over Int).
Distinct from Int at the type level so tcp.write can’t accept an
arbitrary integer; runtime representation stays Value::Int(fd).
Cross over with fd->socket / socket->fd when really needed (FFI).
Quotation(Box<Effect>)
Quotation type (stateless code block with stack effect) Example: [ Int – Int ] is a quotation that takes Int and produces Int No captured values - backward compatible with existing quotations
Closure
Closure type (quotation with captured environment)
Example: Closure { effect: [Int -- Int], captures: [Int] }
A closure that captures one Int and takes another Int to produce Int
Fields
Union(String)
Union type - references a union definition by name
Example: Message in union Message { Get { ... } Increment { ... } }
The full definition is looked up in the type environment
Variant
Anonymous variant value — a tagged variant of unspecified union shape.
This is the compile-time mate of the runtime Value::Variant for cases
where we know the value is a variant but not which union it belongs to.
Used by the low-level variant.* builtins (variant.field-at, variant.tag,
variant.make-N, etc.). A Type::Union(name) is accepted where Variant
is expected (one-way relaxation, see unification).
Var(String)
Type variable (for polymorphism) Example: T in ( ..a T – ..a T T )