pub enum TermKind {
Show 17 variants
Int(i64),
Char(char),
String(String),
Float(f64),
Identifier(Reference),
Fun {
param: String,
body: Box<Term>,
},
Apply {
fun: Box<Term>,
arg: Box<Term>,
saturation: Saturation,
},
If {
cond: Box<Term>,
true_branch: Box<Term>,
false_branch: Box<Term>,
},
Let {
binding: String,
value: Box<Term>,
body: Box<Term>,
},
Tuple(Tuple<Term>),
Unit,
Case {
scrutinee: Box<Term>,
branches: Vec<(TermPattern, Box<Term>)>,
form: CaseForm,
},
Hole,
Record(Vec<Field<Term>>),
Update {
record: Box<Term>,
fields: Vec<Field<Term>>,
},
Access {
record: Box<Term>,
label: Name,
label_span: NodeSpan,
},
Accessor {
label: Name,
label_span: NodeSpan,
},
}Variants§
Int(i64)
An integer literal, at the width Int is
(DEC-16). Inference never reads the value
— every integer literal is an Int whatever its value — but code generation does.
Char(char)
String(String)
A string literal’s value, its escape sequences already read.
Float(f64)
Identifier(Reference)
Fun
Apply
If
Let
Tuple(Tuple<Term>)
Unit
The unit value, ().
Case
Fields
branches: Vec<(TermPattern, Box<Term>)>Hole
A name that did not resolve, translated from canonical::ExpressionKind::Hole.
Inference gives it a fresh type variable and constrains nothing by it, so its type
is whatever the node around it requires (DEC-23 decision
6).
Record(Vec<Field<Term>>)
A record, its fields in the order they were written. Only its type is a set of fields; the term keeps the order, since fields are evaluated in it.
Update
An update: the record updated, and the fields replaced in it in the order they were written.
Access
A field access, record.label.
Accessor
An accessor, .label: the function
reading that field of whichever record it is applied to.