···
213
213
deprecated environment variables.
214
214
([Surya Rose](https://github.com/GearsDatapacks))
215
215
216
216
-
- When generating documentation, the build tool now prints correct type variable
217
217
-
names for function signatures. For example, this code:
216
216
+
- When generating documentation, the build tool now prints type variable using
217
217
+
the same names as were used in the code for function signatures. For example,
218
218
+
this code:
218
219
219
220
```gleam
220
220
-
pub fn to_list(list: List(#(key, value))) -> Dict(key, value) {
221
221
+
pub fn to_list(entries: List(#(key, value))) -> Dict(key, value) {
221
222
...
222
223
}
223
224
```
···
225
226
Previously would have been printed as:
226
227
227
228
```gleam
228
228
-
pub fn to_list(list: List(#(a, b))) -> Dict(a, b)
229
229
+
pub fn to_list(entries: List(#(a, b))) -> Dict(a, b)
229
230
```
230
231
231
232
But now is rendered as the following:
232
233
233
234
```gleam
234
234
-
pub fn to_list(list: List(#(key, value))) -> Dict(key, value)
235
235
+
pub fn to_list(entries: List(#(key, value))) -> Dict(key, value)
235
236
```
236
237
237
238
([Surya Rose](https://github.com/GearsDatapacks))
···
127
127
source_url: source_links.url(*location),
128
128
opaque: *opaque,
129
129
}),
130
130
-
131
130
Definition::TypeAlias(TypeAlias {
132
131
publicity: Publicity::Public,
133
132
location,
···
150
149
},
151
150
opaque: false,
152
151
}),
153
153
-
154
154
-
_ => None,
152
152
+
Definition::TypeAlias(_)
153
153
+
| Definition::CustomType(_)
154
154
+
| Definition::Function(_)
155
155
+
| Definition::Import(_)
156
156
+
| Definition::ModuleConstant(_) => None,
155
157
}
156
158
}
157
159
···
208
210
},
209
211
}),
210
212
211
211
-
_ => None,
213
213
+
Definition::TypeAlias(_)
214
214
+
| Definition::CustomType(_)
215
215
+
| Definition::Function(_)
216
216
+
| Definition::Import(_)
217
217
+
| Definition::ModuleConstant(_) => None,
212
218
}
213
219
}
214
220
···
436
442
437
443
loop {
438
444
n = rest % alphabet_length;
439
439
-
rest /= alphabet_length;
445
445
+
rest = rest / alphabet_length;
440
446
chars.push((n as u8 + char_offset) as char);
441
447
442
448
if rest == 0 {
···
598
598
599
599
</div>
600
600
601
601
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
601
601
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
602
602
603
603
<div class="rendered-markdown"><p>Here is some documentation</p>
604
604
</div>
···
965
965
966
966
</div>
967
967
968
968
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
968
968
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
969
969
970
970
<div class="rendered-markdown"><p>Here is some documentation</p>
971
971
</div>
···
264
264
265
265
</div>
266
266
267
267
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">discard</span>(<span class="hljs-variable">discarded</span>: <span class="hljs-variable">a</span>) -> <span class="hljs-title">Int</span></code></pre>
267
267
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">discard</span>(<span class="hljs-variable">discarded</span>: <span class="hljs-variable">a</span>) -> <span class="hljs-title">Int</span></code></pre>
268
268
269
269
<div class="rendered-markdown"></div>
270
270
</div>
···
272
272
273
273
<div class="custom-type-constructors">
274
274
<div class="rendered-markdown"></div>
275
275
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub type </span><span class="hljs-title">Wibble</span> {
275
275
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub type </span><span class="hljs-title">Wibble</span> {
276
276
<span class="hljs-title">Wobble</span>(<span class="hljs-variable">wabble</span>: <span class="hljs-title">Int</span>)
277
277
}</code></pre>
278
278
···
284
284
<li class="constructor-item">
285
285
<div class="constructor-row">
286
286
<svg class="icon icon-star"><use xlink:href="#icon-star"></use></svg>
287
287
-
<pre class="constructor-name"><code class="hljs gleam hljs-ignore"><span class="hljs-title">Wobble</span>(<span class="hljs-variable">wabble</span>: <span class="hljs-title">Int</span>)</code></pre>
287
287
+
<pre class="constructor-name"><code class="hljs hljs-ignore"><span class="hljs-title">Wobble</span>(<span class="hljs-variable">wabble</span>: <span class="hljs-title">Int</span>)</code></pre>
288
288
</div>
289
289
290
290
<div class="constructor-item-docs">
···
335
335
336
336
</div>
337
337
338
338
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">main</span>() -> <span class="hljs-variable">a</span></code></pre>
338
338
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">main</span>() -> <span class="hljs-variable">a</span></code></pre>
339
339
340
340
<div class="rendered-markdown"></div>
341
341
</div>
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub fn wibble(_a, _b, _c, _d) {
9
9
+
todo
10
10
+
}
11
11
+
12
12
+
5
13
---- VALUES
6
14
7
15
--- wibble
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub fn wibble(_a: a, _b: b, _c: c) -> d {
9
9
+
todo
10
10
+
}
11
11
+
12
12
+
pub fn identity(x) { x }
13
13
+
14
14
+
5
15
---- VALUES
6
16
7
17
--- identity
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub fn wibble(_a: b, _b: a, _c, _d) {
9
9
+
todo
10
10
+
}
11
11
+
12
12
+
5
13
---- VALUES
6
14
7
15
--- wibble
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub fn wibble(_a, _b, _c: b, _d: a) {
9
9
+
todo
10
10
+
}
11
11
+
12
12
+
5
13
---- VALUES
6
14
7
15
--- wibble
···
264
264
265
265
</div>
266
266
267
267
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
267
267
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
268
268
269
269
<div class="rendered-markdown"><p>Here is some documentation</p>
270
270
</div>
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub const x = 22
9
9
+
10
10
+
5
11
---- VALUES
6
12
7
13
--- x
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub type Wibble(a, b) {
9
9
+
Wibble(a, i: Int)
10
10
+
Wobble(b: b, c: String)
11
11
+
}
12
12
+
13
13
+
5
14
---- TYPES
6
15
7
16
--- Wibble
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub fn wibble(list: List(Int), generic: a, function: fn(a) -> b) -> #(a, b) { todo }
9
9
+
10
10
+
5
11
---- VALUES
6
12
7
13
--- wibble
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub opaque type Wibble(a, b) {
9
9
+
Wibble(a, i: Int)
10
10
+
Wobble(b: b, c: String)
11
11
+
}
12
12
+
13
13
+
5
14
---- TYPES
6
15
7
16
--- Wibble
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub type Option(a) = Result(a, Nil)
9
9
+
10
10
+
5
11
---- TYPES
6
12
7
13
--- Option
···
264
264
265
265
</div>
266
266
267
267
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>(<span class="hljs-variable">arg</span>: <span class="hljs-variable">a</span>) -> <span class="hljs-title">Int</span></code></pre>
267
267
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>(<span class="hljs-variable">arg</span>: <span class="hljs-variable">a</span>) -> <span class="hljs-title">Int</span></code></pre>
268
268
269
269
<div class="rendered-markdown"></div>
270
270
</div>
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- gleam/dict.gleam
7
7
+
pub type Dict(a, b)
8
8
+
9
9
+
-- main.gleam
10
10
+
11
11
+
import gleam/dict
12
12
+
13
13
+
pub fn make_dict() -> dict.Dict(a, b) { todo }
14
14
+
15
15
+
5
16
---- VALUES
6
17
7
18
--- make_dict
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- gleam/dict.gleam
7
7
+
pub type Dict(a, b)
8
8
+
9
9
+
-- main.gleam
10
10
+
11
11
+
import gleam/dict
12
12
+
13
13
+
pub fn make_dict() -> dict.Dict(a, b) { todo }
14
14
+
15
15
+
5
16
---- VALUES
6
17
7
18
--- make_dict
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub type Dict(a, b)
9
9
+
10
10
+
pub fn new() -> Dict(a, b) { todo }
11
11
+
12
12
+
5
13
---- TYPES
6
14
7
15
--- Dict
···
272
272
273
273
<div class="custom-type-constructors">
274
274
<div class="rendered-markdown"></div>
275
275
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub type </span><span class="hljs-title">Option</span>(<span class="hljs-variable">t</span>) {
275
275
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub type </span><span class="hljs-title">Option</span>(<span class="hljs-variable">t</span>) {
276
276
<span class="hljs-title">Some</span>(<span class="hljs-variable">t</span>)
277
277
<span class="hljs-title">None</span>
278
278
}</code></pre>
···
285
285
<li class="constructor-item">
286
286
<div class="constructor-row">
287
287
<svg class="icon icon-star"><use xlink:href="#icon-star"></use></svg>
288
288
-
<pre class="constructor-name"><code class="hljs gleam hljs-ignore"><span class="hljs-title">Some</span>(<span class="hljs-variable">t</span>)</code></pre>
288
288
+
<pre class="constructor-name"><code class="hljs hljs-ignore"><span class="hljs-title">Some</span>(<span class="hljs-variable">t</span>)</code></pre>
289
289
</div>
290
290
291
291
<div class="constructor-item-docs">
···
298
298
<li class="constructor-item">
299
299
<div class="constructor-row">
300
300
<svg class="icon icon-star"><use xlink:href="#icon-star"></use></svg>
301
301
-
<pre class="constructor-name"><code class="hljs gleam hljs-ignore"><span class="hljs-title">None</span></code></pre>
301
301
+
<pre class="constructor-name"><code class="hljs hljs-ignore"><span class="hljs-title">None</span></code></pre>
302
302
</div>
303
303
304
304
<div class="constructor-item-docs">
···
333
333
334
334
</div>
335
335
336
336
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">lazy_or</span>(
336
336
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">lazy_or</span>(
337
337
<span class="hljs-variable">first</span>: <a href="#Option"><span class="hljs-title">Option</span></a>(<span class="hljs-variable">a</span>),
338
338
<span class="hljs-variable">second</span>: <span class="hljs-keyword">fn</span>() -> <a href="#Option"><span class="hljs-title">Option</span></a>(<span class="hljs-variable">a</span>),
339
339
) -> <a href="#Option"><span class="hljs-title">Option</span></a>(<span class="hljs-variable">a</span>)</code></pre>
···
584
584
585
585
</div>
586
586
587
587
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
587
587
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
588
588
589
589
<div class="rendered-markdown"><p>Here is some documentation</p>
590
590
</div>
···
944
944
945
945
</div>
946
946
947
947
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
947
947
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
948
948
949
949
<div class="rendered-markdown"><p>Here is some documentation</p>
950
950
</div>
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub fn int_to_string(i: Int) -> String { todo }
9
9
+
10
10
+
5
11
---- VALUES
6
12
7
13
--- int_to_string
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- gleam/option.gleam
7
7
+
8
8
+
pub type Option(t) {
9
9
+
Some(t)
10
10
+
None
11
11
+
}
12
12
+
13
13
+
14
14
+
-- main.gleam
15
15
+
16
16
+
import gleam/option.{type Option, Some, None}
17
17
+
18
18
+
pub fn from_option(o: Option(t), e: e) -> Result(t, e) {
19
19
+
case o {
20
20
+
Some(t) -> Ok(t)
21
21
+
None -> Error(e)
22
22
+
}
23
23
+
}
24
24
+
25
25
+
5
26
---- VALUES
6
27
7
28
--- from_option
···
2
2
source: compiler-core/src/docs/tests.rs
3
3
expression: output
4
4
---
5
5
+
---- SOURCE CODE
6
6
+
-- main.gleam
7
7
+
8
8
+
pub type Dict(key, value)
9
9
+
10
10
+
pub fn insert(dict: Dict(key, value), key: key, value: value) -> Dict(key, value) {
11
11
+
dict
12
12
+
}
13
13
+
14
14
+
5
15
---- TYPES
6
16
7
17
--- Dict
···
264
264
265
265
</div>
266
266
267
267
-
<pre><code class="hljs gleam hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
267
267
+
<pre><code class="hljs hljs-ignore"><span class="hljs-keyword">pub fn </span><span class="hljs-title">one</span>() -> <span class="hljs-title">Int</span></code></pre>
268
268
269
269
<div class="rendered-markdown"><table><thead><tr><th>heading 1</th><th>heading 2</th></tr></thead><tbody>
270
270
<tr><td>row 1 cell 1</td><td>row 1 cell 2</td></tr>
···
137
137
modules: Vec<(&str, &str, &str)>,
138
138
options: PrintOptions,
139
139
) -> EcoString {
140
140
-
let module = type_::tests::compile_module("main", main_module, None, modules)
140
140
+
let module = type_::tests::compile_module("main", main_module, None, modules.clone())
141
141
.expect("Module should compile successfully");
142
142
143
143
let mut config = PackageConfig::default();
···
181
181
182
182
let mut output = EcoString::new();
183
183
184
184
+
output.push_str("---- SOURCE CODE\n");
185
185
+
for (_package, name, src) in modules {
186
186
+
output.push_str(&format!("-- {name}.gleam\n{src}\n\n"));
187
187
+
}
188
188
+
output.push_str("-- main.gleam\n");
189
189
+
output.push_str(main_module);
190
190
+
184
191
if !types.is_empty() {
185
185
-
output.push_str("---- TYPES");
192
192
+
output.push_str("\n\n---- TYPES");
186
193
}
187
194
for type_ in types {
188
195
output.push_str("\n\n--- ");
···
55
55
{% endif %}
56
56
<div class="custom-type-constructors">
57
57
<div class="rendered-markdown">{{ typ.documentation|safe }}</div>
58
58
-
<pre><code class="hljs gleam hljs-ignore">{{ typ.definition|safe }}</code></pre>
58
58
+
<pre><code class="hljs hljs-ignore">{{ typ.definition|safe }}</code></pre>
59
59
{% if !typ.constructors.is_empty() %}
60
60
<h3>
61
61
Constructors
···
65
65
<li class="constructor-item">
66
66
<div class="constructor-row">
67
67
<svg class="icon icon-star"><use xlink:href="#icon-star"></use></svg>
68
68
-
<pre class="constructor-name"><code class="hljs gleam hljs-ignore">{{ constructor.definition|safe }}</code></pre>
68
68
+
<pre class="constructor-name"><code class="hljs hljs-ignore">{{ constructor.definition|safe }}</code></pre>
69
69
</div>
70
70
71
71
<div class="constructor-item-docs">
···
119
119
{% endif %}
120
120
</div>
121
121
122
122
-
<pre><code class="hljs gleam hljs-ignore">{{ value.definition|safe }}</code></pre>
122
122
+
<pre><code class="hljs hljs-ignore">{{ value.definition|safe }}</code></pre>
123
123
{% if !value.deprecation_message.is_empty() %}
124
124
<p>
125
125
<b>Deprecated:</b> {{ value.deprecation_message }}