Builtins are part of the type system — not modules and not prelude bindings.
| Type | Description |
|---|---|
int |
Machine integer |
float |
Floating point |
bool |
true / false |
string |
UTF-8 string (Go string; indexing via prelude is by byte) |
unit |
Unit type () |
bytes |
Byte sequence |
rune |
Unicode code point |
'a ref |
Mutable reference cell |
Optional import-style constructor: std.ref (make). ! / := are language syntax.
Prelude string ops: string_concat, String.length, String.sub — see prelude. Optional import-style access: std.string.
| Syntax | Meaning |
|---|---|
'a list |
Polymorphic list type |
[] |
Empty list |
x :: xs |
Cons |
[a; b; c] |
List literal |
Prelude: list_length, list_append, List.filter / map / fold / find. std.list re-exports Filter / Map / Fold.
| Syntax | Meaning |
|---|---|
'a array |
OCaml-style dynamic array (lowers to Go slice) |
Array.make n default |
Allocate and initialize (prelude) |
Array.length arr |
Element count (prelude) |
arr.(i) |
Index read |
arr.(i) <- v |
In-place write |
Optional import-style access: std.array.
| Syntax | Meaning |
|---|---|
map[K] V |
First-class map (lowers to Go map[K]V) |
Map.make () |
Empty map (prelude) |
Map.get / add / remove / mem / size |
Prelude ops |
See prelude and 29-maps.md. Optional re-export: std.map.
| Constructor | Type |
|---|---|
None |
'a option |
Some x |
'a option |
Optional predicates: std.option.
| Constructor | Type |
|---|---|
Ok x |
('ok, 'err) result |
Error e |
('ok, 'err) result |
Optional predicates: std.result. Propagate with match (no ?).
| Type | Created via |
|---|---|
'a chan |
Chan.make (prelude) |
'a owned_chan |
OwnedChan.make (prelude, linear) |
Optional import-style access: std.chan.
| Type / syntax | Meaning |
|---|---|
'a go_slice |
Go slice at the FFI boundary |
error |
Go error interface |
any / obj |
Empty interface (obj is gosig spelling) |
spread |
Expand a go_slice in a variadic Go call |
See 27-ffi-boundary.md and prelude FFI helpers.
| Syntax / binding | Meaning |
|---|---|
'a lazy |
Deferred computation |
lazy e |
Language syntax |
Lazy.force / Lazy.from_val |
Prelude only (no std.lazy yet) |
- Refinements —
whereclauses on parameters/returns; optional Z3 SMT - Branding — single-constructor ADT (+ optional
private); nonewtype - Linear types —
type handle : 1for quantity-1 resources - Effects —
effect/perform/ handlers (CPS-lowered); nowith { io }rows
See type system and syntax.