Skip to content

Commit 48746c8

Browse files
committed
Improve doc comments
1 parent 5187dbe commit 48746c8

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

pikelet/src/lang/core.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,21 @@ pub enum Term {
8383
RecordType(Arc<[(String, Arc<Term>)]>),
8484
/// Record terms.
8585
RecordTerm(BTreeMap<String, Arc<Term>>),
86-
/// Record eliminations (field access).
86+
/// Record eliminations.
87+
///
88+
/// Also known as: record projection, field lookup.
8789
RecordElim(Arc<Term>, String),
8890
/// Function types.
91+
///
92+
/// Also known as: pi type, dependent product type.
8993
FunctionType(Option<String>, Arc<Term>, Arc<Term>),
90-
/// Function terms (lambda abstractions).
94+
/// Function terms.
95+
///
96+
/// Also known as: lambda abstraction, anonymous function.
9197
FunctionTerm(String, Arc<Term>),
92-
/// Function eliminations (function application).
98+
/// Function eliminations.
99+
///
100+
/// Also known as: function application.
93101
FunctionElim(Arc<Term>, Arc<Term>),
94102
/// Lift a term by the given number of universe levels.
95103
Lift(Arc<Term>, UniverseOffset),
@@ -193,15 +201,15 @@ impl Default for Globals {
193201
}
194202
}
195203

196-
/// An index into the local environment.
204+
/// A De Bruijn index into the local environment.
197205
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
198206
pub struct LocalIndex(pub u32);
199207

200-
/// An level into the local environment.
208+
/// A De Bruijn level into the local environment.
201209
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
202210
pub struct LocalLevel(u32);
203211

204-
/// The size of the local environment.
212+
/// The size of the local environment, used for index-to-level conversions.
205213
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
206214
pub struct LocalSize(u32);
207215

pikelet/src/lang/core/semantics.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ pub enum Value {
5151
/// Record terms.
5252
RecordTerm(BTreeMap<String, Arc<Value>>),
5353
/// Function types.
54+
///
55+
/// Also known as: pi type, dependent product type.
5456
FunctionType(Option<String>, Arc<Value>, Closure),
55-
/// Function terms (lambda abstractions).
57+
/// Function terms.
58+
///
59+
/// Also known as: lambda abstraction, anonymous function.
5660
FunctionTerm(String, Closure),
5761

5862
/// Error sentinel.
@@ -96,9 +100,13 @@ pub enum Head {
96100
/// An eliminator, to be used in the spine of an elimination.
97101
#[derive(Clone, Debug)]
98102
pub enum Elim {
99-
/// Record eliminators (field access).
103+
/// Record eliminators.
104+
///
105+
/// Also known as: record projections, field lookup.
100106
Record(String),
101-
/// Function eliminatiors (function application).
107+
/// Function eliminators.
108+
///
109+
/// Also known as: function application.
102110
Function(Arc<LazyValue>),
103111
}
104112

pikelet/src/lang/surface.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub type TermEntry<S> = (Range<usize>, S, Term<S>);
2929
/// A group of function parameters that are elements of the same type.
3030
pub type ParameterGroup<S> = (Vec<(Range<usize>, S)>, Term<S>);
3131

32+
/// Terms in the surface language.
3233
#[derive(Debug, Clone)]
3334
pub enum Term<S> {
3435
/// Names.
@@ -43,15 +44,25 @@ pub enum Term<S> {
4344
RecordType(Range<usize>, Vec<TypeEntry<S>>),
4445
/// Record terms.
4546
RecordTerm(Range<usize>, Vec<TermEntry<S>>),
46-
/// Record eliminations (field access).
47+
/// Record eliminations.
48+
///
49+
/// Also known as: record projections, field lookup.
4750
RecordElim(Box<Term<S>>, Range<usize>, S),
4851
/// Function types.
52+
///
53+
/// Also known as: pi type, dependent product type.
4954
FunctionType(RangeFrom<usize>, Vec<ParameterGroup<S>>, Box<Term<S>>),
5055
/// Arrow function types.
56+
///
57+
/// Also known as: non-dependent function type.
5158
FunctionArrowType(Box<Term<S>>, Box<Term<S>>),
52-
/// Function terms (lambda abstractions).
59+
/// Function terms.
60+
///
61+
/// Also known as: lambda abstraction, anonymous function.
5362
FunctionTerm(RangeFrom<usize>, Vec<(Range<usize>, S)>, Box<Term<S>>),
54-
/// Function eliminations (function application).
63+
/// Function eliminations.
64+
///
65+
/// Also known as: function application.
5566
FunctionElim(Box<Term<S>>, Vec<Term<S>>),
5667
/// Lift a term by the given number of universe levels.
5768
Lift(Range<usize>, Box<Term<S>>, u32),

0 commit comments

Comments
 (0)