-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathBasicTypes.lean
184 lines (127 loc) · 3.13 KB
/
BasicTypes.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/-
Copyright (c) 2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import VersoManual
import Manual.Meta
import Manual.BasicTypes.Nat
import Manual.BasicTypes.String
open Manual.FFIDocType
open Verso.Genre Manual
set_option pp.rawOnError true
#doc (Manual) "Basic Types" =>
%%%
tag := "basic-types"
%%%
Lean includes a number of built-in types that are specially supported by the compiler.
Some, such as {lean}`Nat`, additionally have special support in the kernel.
Other types don't have special compiler support _per se_, but rely in important ways on the internal representation of types for performance reasons.
{include 0 Manual.BasicTypes.Nat}
# Integers
%%%
tag := "Int"
%%%
::: planned 104
* Compile-time and run-time characteristics, and how they're inherited from {lean}`Nat`
* API reference
:::
# Fixed-Precision Integer Types
%%%
tag := "fixed-ints"
%%%
::: planned 105
* Compile-time and run-time characteristics for {lean}`UInt8`, {lean}`UInt16`, {lean}`UInt32`, {lean}`UInt64`
* API reference
:::
# Bitvectors
%%%
tag := "BitVec"
%%%
:::planned 106
* Run-time and kernel representations of {name}`BitVec`
* API reference
* Cross-reference to TBW chapter on `bv_decide`
:::
# Floating-Point Numbers
%%%
tag := "Float"
%%%
:::planned 107
* Run-time and kernel representations
* Precision, and whether it's platform-dependent
* Relationship between IEEE floats and decidable equality
:::
# Characters
%%%
tag := "Char"
%%%
{docstring Char}
## Syntax
%%%
tag := "char-syntax"
%%%
## Logical Model
%%%
tag := "char-model"
%%%
## Run-Time Representation
%%%
tag := "char-runtime"
%%%
In monomorphic contexts, characters are represented as 32-bit immediate values. In other words, a field of a constructor or structure of type `Char` does not require indirection to access. In polymorphic contexts, characters are boxed.
## API Reference
%%%
tag := "char-api"
%%%
### Character Classes
%%%
tag := "char-api-classes"
%%%
{docstring Char.isAlpha}
{docstring Char.isAlphanum}
{docstring Char.isDigit}
{docstring Char.isLower}
{docstring Char.isUpper}
{docstring Char.isWhitespace}
{include 0 Manual.BasicTypes.String}
# Linked Lists
%%%
tag := "List"
%%%
::: planned 108
* Representation at compile time and run time
* API reference
* Literal syntax
* Constructor/pattern syntax
:::
# Arrays
%%%
tag := "Array"
%%%
::: planned 91
Description and API reference for {name}`Thunk`:
* Logical model as wrapper around a function from {lean}`Unit`
* Run-time realization as a lazy computation
* API reference
:::
# Lazy Computations
%%%
tag := "Thunk"
%%%
::: planned 92
Description and API reference for {name}`Thunk`:
* Logical model as wrapper around a function from {lean}`Unit`
* Run-time realization as a lazy computation
* API reference
:::
# Tasks and Threads
%%%
tag := "concurrency"
%%%
::: planned 90
Description and API reference for {name}`Task` and runtime threads, including {lean}`IO.Promise`
* Scheduling model
* Things to be careful of
This section may be moved to the section on {name}`IO` in particular.
:::