@grain/stdlib 0.6.6 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/LICENSE +1 -1
  3. package/README.md +2 -2
  4. package/array.gr +55 -7
  5. package/array.md +606 -560
  6. package/bigint.md +228 -228
  7. package/buffer.gr +85 -53
  8. package/buffer.md +442 -319
  9. package/bytes.gr +112 -35
  10. package/bytes.md +299 -219
  11. package/char.gr +201 -99
  12. package/char.md +447 -120
  13. package/exception.gr +11 -11
  14. package/exception.md +29 -4
  15. package/float32.gr +327 -3
  16. package/float32.md +698 -111
  17. package/float64.gr +320 -3
  18. package/float64.md +698 -111
  19. package/fs.gr +1082 -0
  20. package/fs.md +630 -0
  21. package/hash.gr +142 -88
  22. package/hash.md +105 -17
  23. package/int16.md +178 -178
  24. package/int32.gr +26 -5
  25. package/int32.md +266 -231
  26. package/int64.gr +27 -2
  27. package/int64.md +266 -231
  28. package/int8.md +178 -178
  29. package/json.gr +366 -51
  30. package/json.md +431 -15
  31. package/list.gr +328 -31
  32. package/list.md +759 -336
  33. package/map.gr +20 -12
  34. package/map.md +266 -260
  35. package/marshal.gr +41 -40
  36. package/marshal.md +14 -14
  37. package/number.gr +278 -35
  38. package/number.md +688 -269
  39. package/option.md +162 -162
  40. package/package.json +5 -3
  41. package/path.gr +48 -0
  42. package/path.md +180 -89
  43. package/pervasives.gr +2 -2
  44. package/pervasives.md +275 -275
  45. package/priorityqueue.gr +7 -7
  46. package/priorityqueue.md +131 -131
  47. package/queue.gr +183 -29
  48. package/queue.md +404 -148
  49. package/random.md +43 -43
  50. package/range.gr +4 -4
  51. package/range.md +42 -42
  52. package/rational.md +123 -123
  53. package/regex.gr +52 -51
  54. package/regex.md +102 -102
  55. package/result.md +118 -118
  56. package/runtime/atof/common.md +39 -39
  57. package/runtime/atof/decimal.gr +6 -6
  58. package/runtime/atof/decimal.md +14 -14
  59. package/runtime/atof/lemire.gr +5 -5
  60. package/runtime/atof/lemire.md +1 -1
  61. package/runtime/atof/parse.gr +16 -16
  62. package/runtime/atof/parse.md +2 -2
  63. package/runtime/atof/slow.md +1 -1
  64. package/runtime/atof/table.md +2 -2
  65. package/runtime/atoi/parse.gr +3 -3
  66. package/runtime/atoi/parse.md +1 -1
  67. package/runtime/bigint.gr +15 -47
  68. package/runtime/bigint.md +54 -60
  69. package/runtime/compare.gr +2 -2
  70. package/runtime/compare.md +8 -8
  71. package/runtime/dataStructures.md +211 -211
  72. package/runtime/debugPrint.gr +4 -1
  73. package/runtime/debugPrint.md +9 -9
  74. package/runtime/equal.gr +99 -77
  75. package/runtime/equal.md +8 -8
  76. package/runtime/exception.gr +62 -82
  77. package/runtime/exception.md +62 -11
  78. package/runtime/gc.gr +39 -45
  79. package/runtime/gc.md +4 -4
  80. package/runtime/malloc.gr +7 -7
  81. package/runtime/malloc.md +13 -13
  82. package/runtime/math/kernel/cos.gr +70 -0
  83. package/runtime/math/kernel/cos.md +14 -0
  84. package/runtime/math/kernel/sin.gr +65 -0
  85. package/runtime/math/kernel/sin.md +14 -0
  86. package/runtime/math/kernel/tan.gr +136 -0
  87. package/runtime/math/kernel/tan.md +14 -0
  88. package/runtime/math/rempio2.gr +244 -0
  89. package/runtime/math/rempio2.md +14 -0
  90. package/runtime/math/trig.gr +130 -0
  91. package/runtime/math/trig.md +28 -0
  92. package/runtime/math/umuldi.gr +26 -0
  93. package/runtime/math/umuldi.md +14 -0
  94. package/runtime/numberUtils.gr +29 -29
  95. package/runtime/numberUtils.md +12 -12
  96. package/runtime/numbers.gr +373 -381
  97. package/runtime/numbers.md +348 -342
  98. package/runtime/string.gr +37 -105
  99. package/runtime/string.md +20 -26
  100. package/runtime/unsafe/constants.md +24 -24
  101. package/runtime/unsafe/conv.md +19 -19
  102. package/runtime/unsafe/memory.gr +24 -20
  103. package/runtime/unsafe/memory.md +27 -7
  104. package/runtime/unsafe/offsets.gr +36 -0
  105. package/runtime/unsafe/offsets.md +88 -0
  106. package/runtime/unsafe/panic.gr +28 -0
  107. package/runtime/unsafe/panic.md +14 -0
  108. package/runtime/unsafe/tags.md +32 -32
  109. package/runtime/unsafe/wasmf32.md +28 -28
  110. package/runtime/unsafe/wasmf64.md +28 -28
  111. package/runtime/unsafe/wasmi32.md +47 -47
  112. package/runtime/unsafe/wasmi64.md +50 -50
  113. package/runtime/utf8.gr +189 -0
  114. package/runtime/utf8.md +117 -0
  115. package/runtime/wasi.gr +4 -2
  116. package/runtime/wasi.md +147 -147
  117. package/set.gr +18 -11
  118. package/set.md +253 -247
  119. package/stack.gr +171 -2
  120. package/stack.md +371 -89
  121. package/string.gr +352 -557
  122. package/string.md +298 -255
  123. package/uint16.md +170 -170
  124. package/uint32.gr +25 -4
  125. package/uint32.md +249 -214
  126. package/uint64.gr +25 -5
  127. package/uint64.md +249 -214
  128. package/uint8.md +170 -170
  129. package/uri.gr +57 -53
  130. package/uri.md +88 -89
  131. package/wasi/file.gr +67 -59
  132. package/wasi/file.md +308 -308
  133. package/wasi/process.md +26 -26
  134. package/wasi/random.md +12 -12
  135. package/wasi/time.md +16 -16
  136. package/runtime/utils/printing.gr +0 -60
  137. package/runtime/utils/printing.md +0 -26
package/option.md CHANGED
@@ -35,22 +35,22 @@ No other changes yet.
35
35
  </details>
36
36
 
37
37
  ```grain
38
- isSome : (option: Option<a>) => Bool
38
+ isSome: (option: Option<a>) => Bool
39
39
  ```
40
40
 
41
41
  Checks if the Option is the `Some` variant.
42
42
 
43
43
  Parameters:
44
44
 
45
- |param|type|description|
46
- |-----|----|-----------|
47
- |`option`|`Option<a>`|The option to check|
45
+ | param | type | description |
46
+ | -------- | ----------- | ------------------- |
47
+ | `option` | `Option<a>` | The option to check |
48
48
 
49
49
  Returns:
50
50
 
51
- |type|description|
52
- |----|-----------|
53
- |`Bool`|`true` if the Option is the `Some` variant or `false` otherwise|
51
+ | type | description |
52
+ | ------ | --------------------------------------------------------------- |
53
+ | `Bool` | `true` if the Option is the `Some` variant or `false` otherwise |
54
54
 
55
55
  ### Option.**isNone**
56
56
 
@@ -60,22 +60,22 @@ No other changes yet.
60
60
  </details>
61
61
 
62
62
  ```grain
63
- isNone : (option: Option<a>) => Bool
63
+ isNone: (option: Option<a>) => Bool
64
64
  ```
65
65
 
66
66
  Checks if the Option is the `None` variant.
67
67
 
68
68
  Parameters:
69
69
 
70
- |param|type|description|
71
- |-----|----|-----------|
72
- |`option`|`Option<a>`|The option to check|
70
+ | param | type | description |
71
+ | -------- | ----------- | ------------------- |
72
+ | `option` | `Option<a>` | The option to check |
73
73
 
74
74
  Returns:
75
75
 
76
- |type|description|
77
- |----|-----------|
78
- |`Bool`|`true` if the Option is the `None` variant or `false` otherwise|
76
+ | type | description |
77
+ | ------ | --------------------------------------------------------------- |
78
+ | `Bool` | `true` if the Option is the `None` variant or `false` otherwise |
79
79
 
80
80
  ### Option.**contains**
81
81
 
@@ -85,23 +85,23 @@ No other changes yet.
85
85
  </details>
86
86
 
87
87
  ```grain
88
- contains : (value: a, option: Option<a>) => Bool
88
+ contains: (value: a, option: Option<a>) => Bool
89
89
  ```
90
90
 
91
91
  Checks if the Option is the `Some` variant and contains the given value. Uses the generic `==` equality operator.
92
92
 
93
93
  Parameters:
94
94
 
95
- |param|type|description|
96
- |-----|----|-----------|
97
- |`value`|`a`|The value to search for|
98
- |`option`|`Option<a>`|The option to search|
95
+ | param | type | description |
96
+ | -------- | ----------- | ----------------------- |
97
+ | `value` | `a` | The value to search for |
98
+ | `option` | `Option<a>` | The option to search |
99
99
 
100
100
  Returns:
101
101
 
102
- |type|description|
103
- |----|-----------|
104
- |`Bool`|`true` if the Option is equivalent to `Some(value)` or `false` otherwise|
102
+ | type | description |
103
+ | ------ | ------------------------------------------------------------------------ |
104
+ | `Bool` | `true` if the Option is equivalent to `Some(value)` or `false` otherwise |
105
105
 
106
106
  ### Option.**expect**
107
107
 
@@ -111,7 +111,7 @@ No other changes yet.
111
111
  </details>
112
112
 
113
113
  ```grain
114
- expect : (msg: String, option: Option<a>) => a
114
+ expect: (msg: String, option: Option<a>) => a
115
115
  ```
116
116
 
117
117
  Extracts the value inside a `Some` option, otherwise throws an
@@ -119,16 +119,16 @@ exception containing the message provided.
119
119
 
120
120
  Parameters:
121
121
 
122
- |param|type|description|
123
- |-----|----|-----------|
124
- |`msg`|`String`|The message to use upon failure|
125
- |`option`|`Option<a>`|The option to extract a value from|
122
+ | param | type | description |
123
+ | -------- | ----------- | ---------------------------------- |
124
+ | `msg` | `String` | The message to use upon failure |
125
+ | `option` | `Option<a>` | The option to extract a value from |
126
126
 
127
127
  Returns:
128
128
 
129
- |type|description|
130
- |----|-----------|
131
- |`a`|The unwrapped value if the Option is the `Some` variant|
129
+ | type | description |
130
+ | ---- | ------------------------------------------------------- |
131
+ | `a` | The unwrapped value if the Option is the `Some` variant |
132
132
 
133
133
  Throws:
134
134
 
@@ -144,7 +144,7 @@ No other changes yet.
144
144
  </details>
145
145
 
146
146
  ```grain
147
- unwrap : (option: Option<a>) => a
147
+ unwrap: (option: Option<a>) => a
148
148
  ```
149
149
 
150
150
  Extracts the value inside a `Some` option, otherwise
@@ -152,15 +152,15 @@ throws an exception containing a default message.
152
152
 
153
153
  Parameters:
154
154
 
155
- |param|type|description|
156
- |-----|----|-----------|
157
- |`option`|`Option<a>`|The option to extract the value from|
155
+ | param | type | description |
156
+ | -------- | ----------- | ------------------------------------ |
157
+ | `option` | `Option<a>` | The option to extract the value from |
158
158
 
159
159
  Returns:
160
160
 
161
- |type|description|
162
- |----|-----------|
163
- |`a`|The unwrapped value if the Option is the `Some` variant|
161
+ | type | description |
162
+ | ---- | ------------------------------------------------------- |
163
+ | `a` | The unwrapped value if the Option is the `Some` variant |
164
164
 
165
165
  Throws:
166
166
 
@@ -176,23 +176,23 @@ No other changes yet.
176
176
  </details>
177
177
 
178
178
  ```grain
179
- unwrapWithDefault : (default: a, option: Option<a>) => a
179
+ unwrapWithDefault: (default: a, option: Option<a>) => a
180
180
  ```
181
181
 
182
182
  Extracts the value inside a `Some` option or provide the default value if `None`.
183
183
 
184
184
  Parameters:
185
185
 
186
- |param|type|description|
187
- |-----|----|-----------|
188
- |`default`|`a`|The default value|
189
- |`option`|`Option<a>`|The option to unwrap|
186
+ | param | type | description |
187
+ | --------- | ----------- | -------------------- |
188
+ | `default` | `a` | The default value |
189
+ | `option` | `Option<a>` | The option to unwrap |
190
190
 
191
191
  Returns:
192
192
 
193
- |type|description|
194
- |----|-----------|
195
- |`a`|The unwrapped value if the Option is the `Some` variant or the default value otherwise|
193
+ | type | description |
194
+ | ---- | -------------------------------------------------------------------------------------- |
195
+ | `a` | The unwrapped value if the Option is the `Some` variant or the default value otherwise |
196
196
 
197
197
  ### Option.**map**
198
198
 
@@ -202,23 +202,23 @@ No other changes yet.
202
202
  </details>
203
203
 
204
204
  ```grain
205
- map : (fn: (a => b), option: Option<a>) => Option<b>
205
+ map: (fn: (a => b), option: Option<a>) => Option<b>
206
206
  ```
207
207
 
208
208
  If the Option is `Some(value)`, applies the given function to the `value` and wraps the new value in a `Some` variant.
209
209
 
210
210
  Parameters:
211
211
 
212
- |param|type|description|
213
- |-----|----|-----------|
214
- |`fn`|`a => b`|The function to call on the value of a `Some` variant|
215
- |`option`|`Option<a>`|The option to map|
212
+ | param | type | description |
213
+ | -------- | ----------- | ----------------------------------------------------- |
214
+ | `fn` | `a => b` | The function to call on the value of a `Some` variant |
215
+ | `option` | `Option<a>` | The option to map |
216
216
 
217
217
  Returns:
218
218
 
219
- |type|description|
220
- |----|-----------|
221
- |`Option<b>`|A new `Some` variant produced by the mapping function if the variant was `Some` or the unmodified `None` otherwise|
219
+ | type | description |
220
+ | ----------- | ------------------------------------------------------------------------------------------------------------------ |
221
+ | `Option<b>` | A new `Some` variant produced by the mapping function if the variant was `Some` or the unmodified `None` otherwise |
222
222
 
223
223
  ### Option.**mapWithDefault**
224
224
 
@@ -228,7 +228,7 @@ No other changes yet.
228
228
  </details>
229
229
 
230
230
  ```grain
231
- mapWithDefault : (fn: (a => b), default: b, option: Option<a>) => b
231
+ mapWithDefault: (fn: (a => b), default: b, option: Option<a>) => b
232
232
  ```
233
233
 
234
234
  If the Option is `Some(value)`, applies the given function to the `value` to produce a new value, otherwise uses the default value.
@@ -236,17 +236,17 @@ Useful for unwrapping an Option while providing a fallback for any `None` varian
236
236
 
237
237
  Parameters:
238
238
 
239
- |param|type|description|
240
- |-----|----|-----------|
241
- |`fn`|`a => b`|The function to call on the value of a `Some` variant|
242
- |`default`|`b`|A fallback value for a `None` variant|
243
- |`option`|`Option<a>`|The option to map|
239
+ | param | type | description |
240
+ | --------- | ----------- | ----------------------------------------------------- |
241
+ | `fn` | `a => b` | The function to call on the value of a `Some` variant |
242
+ | `default` | `b` | A fallback value for a `None` variant |
243
+ | `option` | `Option<a>` | The option to map |
244
244
 
245
245
  Returns:
246
246
 
247
- |type|description|
248
- |----|-----------|
249
- |`b`|The value produced by the mapping function if the Option is of the `Some` variant or the default value otherwise|
247
+ | type | description |
248
+ | ---- | ---------------------------------------------------------------------------------------------------------------- |
249
+ | `b` | The value produced by the mapping function if the Option is of the `Some` variant or the default value otherwise |
250
250
 
251
251
  ### Option.**mapWithDefaultFn**
252
252
 
@@ -256,7 +256,7 @@ No other changes yet.
256
256
  </details>
257
257
 
258
258
  ```grain
259
- mapWithDefaultFn :
259
+ mapWithDefaultFn:
260
260
  (fn: (a => b), defaultFn: (() => b), option: Option<a>) => b
261
261
  ```
262
262
 
@@ -266,17 +266,17 @@ Useful for unwrapping an Option into a value, whether it is `Some` or `None`.
266
266
 
267
267
  Parameters:
268
268
 
269
- |param|type|description|
270
- |-----|----|-----------|
271
- |`fn`|`a => b`|The function to call on the value of a `Some` variant|
272
- |`defaultFn`|`() => b`|The default function|
273
- |`option`|`Option<a>`|The option to map|
269
+ | param | type | description |
270
+ | ----------- | ----------- | ----------------------------------------------------- |
271
+ | `fn` | `a => b` | The function to call on the value of a `Some` variant |
272
+ | `defaultFn` | `() => b` | The default function |
273
+ | `option` | `Option<a>` | The option to map |
274
274
 
275
275
  Returns:
276
276
 
277
- |type|description|
278
- |----|-----------|
279
- |`b`|The value produced by one of the mapping functions|
277
+ | type | description |
278
+ | ---- | -------------------------------------------------- |
279
+ | `b` | The value produced by one of the mapping functions |
280
280
 
281
281
  ### Option.**flatMap**
282
282
 
@@ -286,23 +286,23 @@ No other changes yet.
286
286
  </details>
287
287
 
288
288
  ```grain
289
- flatMap : (fn: (a => Option<b>), option: Option<a>) => Option<b>
289
+ flatMap: (fn: (a => Option<b>), option: Option<a>) => Option<b>
290
290
  ```
291
291
 
292
292
  If the Option is `Some(value)`, applies the given function to the `value` to produce a new Option.
293
293
 
294
294
  Parameters:
295
295
 
296
- |param|type|description|
297
- |-----|----|-----------|
298
- |`fn`|`a => Option<b>`|The function to call on the value of a `Some` variant|
299
- |`option`|`Option<a>`|The option to map|
296
+ | param | type | description |
297
+ | -------- | ---------------- | ----------------------------------------------------- |
298
+ | `fn` | `a => Option<b>` | The function to call on the value of a `Some` variant |
299
+ | `option` | `Option<a>` | The option to map |
300
300
 
301
301
  Returns:
302
302
 
303
- |type|description|
304
- |----|-----------|
305
- |`Option<b>`|A new Option produced by the mapping function if the variant was `Some` or the unmodified `None` otherwise|
303
+ | type | description |
304
+ | ----------- | ---------------------------------------------------------------------------------------------------------- |
305
+ | `Option<b>` | A new Option produced by the mapping function if the variant was `Some` or the unmodified `None` otherwise |
306
306
 
307
307
  ### Option.**filter**
308
308
 
@@ -312,7 +312,7 @@ No other changes yet.
312
312
  </details>
313
313
 
314
314
  ```grain
315
- filter : (fn: (a => Bool), option: Option<a>) => Option<a>
315
+ filter: (fn: (a => Bool), option: Option<a>) => Option<a>
316
316
  ```
317
317
 
318
318
  Converts `Some(value)` variants to `None` variants where the predicate function returns `false`.
@@ -320,16 +320,16 @@ if the `fn` return `true` returns `Some(value)`, otherwise returns `None`.
320
320
 
321
321
  Parameters:
322
322
 
323
- |param|type|description|
324
- |-----|----|-----------|
325
- |`fn`|`a => Bool`|The predicate function to indicate if the option should remain `Some`|
326
- |`option`|`Option<a>`|The option to inspect|
323
+ | param | type | description |
324
+ | -------- | ----------- | --------------------------------------------------------------------- |
325
+ | `fn` | `a => Bool` | The predicate function to indicate if the option should remain `Some` |
326
+ | `option` | `Option<a>` | The option to inspect |
327
327
 
328
328
  Returns:
329
329
 
330
- |type|description|
331
- |----|-----------|
332
- |`Option<a>`|`Some(value)` if the variant was `Some` and the predicate returns `true` or `None` otherwise|
330
+ | type | description |
331
+ | ----------- | -------------------------------------------------------------------------------------------- |
332
+ | `Option<a>` | `Some(value)` if the variant was `Some` and the predicate returns `true` or `None` otherwise |
333
333
 
334
334
  ### Option.**zip**
335
335
 
@@ -339,23 +339,23 @@ No other changes yet.
339
339
  </details>
340
340
 
341
341
  ```grain
342
- zip : (optionA: Option<a>, optionB: Option<b>) => Option<(a, b)>
342
+ zip: (optionA: Option<a>, optionB: Option<b>) => Option<(a, b)>
343
343
  ```
344
344
 
345
345
  Combine two Options into a single Option containing a tuple of their values.
346
346
 
347
347
  Parameters:
348
348
 
349
- |param|type|description|
350
- |-----|----|-----------|
351
- |`optionA`|`Option<a>`|The first option to combine|
352
- |`optionB`|`Option<b>`|The second option to combine|
349
+ | param | type | description |
350
+ | --------- | ----------- | ---------------------------- |
351
+ | `optionA` | `Option<a>` | The first option to combine |
352
+ | `optionB` | `Option<b>` | The second option to combine |
353
353
 
354
354
  Returns:
355
355
 
356
- |type|description|
357
- |----|-----------|
358
- |`Option<(a, b)>`|`Some((valueA, valueB))` if both Options are `Some` variants or `None` otherwise|
356
+ | type | description |
357
+ | ---------------- | -------------------------------------------------------------------------------- |
358
+ | `Option<(a, b)>` | `Some((valueA, valueB))` if both Options are `Some` variants or `None` otherwise |
359
359
 
360
360
  ### Option.**zipWith**
361
361
 
@@ -365,7 +365,7 @@ No other changes yet.
365
365
  </details>
366
366
 
367
367
  ```grain
368
- zipWith :
368
+ zipWith:
369
369
  (fn: ((a, b) => c), optionA: Option<a>, optionB: Option<b>) => Option<c>
370
370
  ```
371
371
 
@@ -373,17 +373,17 @@ Combine two Options into a single Option. The new value is produced by applying
373
373
 
374
374
  Parameters:
375
375
 
376
- |param|type|description|
377
- |-----|----|-----------|
378
- |`fn`|`(a, b) => c`|The function to generate a new value|
379
- |`optionA`|`Option<a>`|The first option to combine|
380
- |`optionB`|`Option<b>`|The second option to combine|
376
+ | param | type | description |
377
+ | --------- | ------------- | ------------------------------------ |
378
+ | `fn` | `(a, b) => c` | The function to generate a new value |
379
+ | `optionA` | `Option<a>` | The first option to combine |
380
+ | `optionB` | `Option<b>` | The second option to combine |
381
381
 
382
382
  Returns:
383
383
 
384
- |type|description|
385
- |----|-----------|
386
- |`Option<c>`|`Some(newValue)` if both Options are `Some` variants or `None` otherwise|
384
+ | type | description |
385
+ | ----------- | ------------------------------------------------------------------------ |
386
+ | `Option<c>` | `Some(newValue)` if both Options are `Some` variants or `None` otherwise |
387
387
 
388
388
  ### Option.**flatten**
389
389
 
@@ -393,22 +393,22 @@ No other changes yet.
393
393
  </details>
394
394
 
395
395
  ```grain
396
- flatten : (option: Option<Option<a>>) => Option<a>
396
+ flatten: (option: Option<Option<a>>) => Option<a>
397
397
  ```
398
398
 
399
399
  Flattens nested Options.
400
400
 
401
401
  Parameters:
402
402
 
403
- |param|type|description|
404
- |-----|----|-----------|
405
- |`option`|`Option<Option<a>>`|The option to flatten|
403
+ | param | type | description |
404
+ | -------- | ------------------- | --------------------- |
405
+ | `option` | `Option<Option<a>>` | The option to flatten |
406
406
 
407
407
  Returns:
408
408
 
409
- |type|description|
410
- |----|-----------|
411
- |`Option<a>`|`Some(innerValue)` if all nested options were the `Some` variant or `None` otherwise|
409
+ | type | description |
410
+ | ----------- | ------------------------------------------------------------------------------------ |
411
+ | `Option<a>` | `Some(innerValue)` if all nested options were the `Some` variant or `None` otherwise |
412
412
 
413
413
  Examples:
414
414
 
@@ -424,22 +424,22 @@ No other changes yet.
424
424
  </details>
425
425
 
426
426
  ```grain
427
- toList : (option: Option<a>) => List<a>
427
+ toList: (option: Option<a>) => List<a>
428
428
  ```
429
429
 
430
430
  Converts an Option to a list with either zero or one item.
431
431
 
432
432
  Parameters:
433
433
 
434
- |param|type|description|
435
- |-----|----|-----------|
436
- |`option`|`Option<a>`|The option to convert|
434
+ | param | type | description |
435
+ | -------- | ----------- | --------------------- |
436
+ | `option` | `Option<a>` | The option to convert |
437
437
 
438
438
  Returns:
439
439
 
440
- |type|description|
441
- |----|-----------|
442
- |`List<a>`|`[value]` if the Option was the `Some` variant or `[]` otherwise|
440
+ | type | description |
441
+ | --------- | ---------------------------------------------------------------- |
442
+ | `List<a>` | `[value]` if the Option was the `Some` variant or `[]` otherwise |
443
443
 
444
444
  ### Option.**toArray**
445
445
 
@@ -449,22 +449,22 @@ No other changes yet.
449
449
  </details>
450
450
 
451
451
  ```grain
452
- toArray : (option: Option<a>) => Array<a>
452
+ toArray: (option: Option<a>) => Array<a>
453
453
  ```
454
454
 
455
455
  Converts an Option to an array with either zero or one item.
456
456
 
457
457
  Parameters:
458
458
 
459
- |param|type|description|
460
- |-----|----|-----------|
461
- |`option`|`Option<a>`|The option to convert|
459
+ | param | type | description |
460
+ | -------- | ----------- | --------------------- |
461
+ | `option` | `Option<a>` | The option to convert |
462
462
 
463
463
  Returns:
464
464
 
465
- |type|description|
466
- |----|-----------|
467
- |`Array<a>`|`[> value]` if the Option was the `Some` variant or `[> ]` otherwise|
465
+ | type | description |
466
+ | ---------- | -------------------------------------------------------------------- |
467
+ | `Array<a>` | `[> value]` if the Option was the `Some` variant or `[> ]` otherwise |
468
468
 
469
469
  ### Option.**toResult**
470
470
 
@@ -474,23 +474,23 @@ No other changes yet.
474
474
  </details>
475
475
 
476
476
  ```grain
477
- toResult : (err: a, option: Option<b>) => Result<b, a>
477
+ toResult: (err: a, option: Option<b>) => Result<b, a>
478
478
  ```
479
479
 
480
480
  Converts the Option to a Result, using the provided error in case of the `None` variant.
481
481
 
482
482
  Parameters:
483
483
 
484
- |param|type|description|
485
- |-----|----|-----------|
486
- |`err`|`a`|The error to use if the option is `None`|
487
- |`option`|`Option<b>`|The option to convert|
484
+ | param | type | description |
485
+ | -------- | ----------- | ---------------------------------------- |
486
+ | `err` | `a` | The error to use if the option is `None` |
487
+ | `option` | `Option<b>` | The option to convert |
488
488
 
489
489
  Returns:
490
490
 
491
- |type|description|
492
- |----|-----------|
493
- |`Result<b, a>`|`Ok(value)` if the Option is `Some(value)` or `Err(err)` if the Option is `None`|
491
+ | type | description |
492
+ | -------------- | -------------------------------------------------------------------------------- |
493
+ | `Result<b, a>` | `Ok(value)` if the Option is `Some(value)` or `Err(err)` if the Option is `None` |
494
494
 
495
495
  ### Option.**sideEffect**
496
496
 
@@ -500,17 +500,17 @@ No other changes yet.
500
500
  </details>
501
501
 
502
502
  ```grain
503
- sideEffect : (fn: (a => Void), option: Option<a>) => Void
503
+ sideEffect: (fn: (a => Void), option: Option<a>) => Void
504
504
  ```
505
505
 
506
506
  If the Option is `Some(value)`, applies the `fn` function to the `value` without producing a new value.
507
507
 
508
508
  Parameters:
509
509
 
510
- |param|type|description|
511
- |-----|----|-----------|
512
- |`fn`|`a => Void`|The function to call on the value of a `Some` variant|
513
- |`option`|`Option<a>`|The option to inspect|
510
+ | param | type | description |
511
+ | -------- | ----------- | ----------------------------------------------------- |
512
+ | `fn` | `a => Void` | The function to call on the value of a `Some` variant |
513
+ | `option` | `Option<a>` | The option to inspect |
514
514
 
515
515
  ### Option.**peek**
516
516
 
@@ -520,7 +520,7 @@ No other changes yet.
520
520
  </details>
521
521
 
522
522
  ```grain
523
- peek : (fn: (a => Void), option: Option<a>) => Option<a>
523
+ peek: (fn: (a => Void), option: Option<a>) => Option<a>
524
524
  ```
525
525
 
526
526
  If the Option is `Some(value)`, applies the `fn` function to the `value` without producing a new value.
@@ -528,16 +528,16 @@ Useful for inspecting Options without changing anything.
528
528
 
529
529
  Parameters:
530
530
 
531
- |param|type|description|
532
- |-----|----|-----------|
533
- |`fn`|`a => Void`|The function to call on the value of a `Some` variant|
534
- |`option`|`Option<a>`|The option to inspect|
531
+ | param | type | description |
532
+ | -------- | ----------- | ----------------------------------------------------- |
533
+ | `fn` | `a => Void` | The function to call on the value of a `Some` variant |
534
+ | `option` | `Option<a>` | The option to inspect |
535
535
 
536
536
  Returns:
537
537
 
538
- |type|description|
539
- |----|-----------|
540
- |`Option<a>`|The unmodified option|
538
+ | type | description |
539
+ | ----------- | --------------------- |
540
+ | `Option<a>` | The unmodified option |
541
541
 
542
542
  ### Option.**(||)**
543
543
 
@@ -554,23 +554,23 @@ Returns:
554
554
  </details>
555
555
 
556
556
  ```grain
557
- (||) : (optionA: Option<a>, optionB: Option<a>) => Option<a>
557
+ (||): (optionA: Option<a>, optionB: Option<a>) => Option<a>
558
558
  ```
559
559
 
560
560
  Behaves like a logical OR (`||`) where the first Option is only returned if it is the `Some` variant and falling back to the second Option in all other cases.
561
561
 
562
562
  Parameters:
563
563
 
564
- |param|type|description|
565
- |-----|----|-----------|
566
- |`optionA`|`Option<a>`|The first option|
567
- |`optionB`|`Option<a>`|The second option|
564
+ | param | type | description |
565
+ | --------- | ----------- | ----------------- |
566
+ | `optionA` | `Option<a>` | The first option |
567
+ | `optionB` | `Option<a>` | The second option |
568
568
 
569
569
  Returns:
570
570
 
571
- |type|description|
572
- |----|-----------|
573
- |`Option<a>`|The first Option if it is the `Some` variant or the second Option otherwise|
571
+ | type | description |
572
+ | ----------- | --------------------------------------------------------------------------- |
573
+ | `Option<a>` | The first Option if it is the `Some` variant or the second Option otherwise |
574
574
 
575
575
  ### Option.**(&&)**
576
576
 
@@ -587,21 +587,21 @@ Returns:
587
587
  </details>
588
588
 
589
589
  ```grain
590
- (&&) : (optionA: Option<a>, optionB: Option<a>) => Option<a>
590
+ (&&): (optionA: Option<a>, optionB: Option<a>) => Option<a>
591
591
  ```
592
592
 
593
593
  Behaves like a logical AND (`&&`) where the first Option is only returned if it is the `None` variant and falling back to the second Option Result in all other cases.
594
594
 
595
595
  Parameters:
596
596
 
597
- |param|type|description|
598
- |-----|----|-----------|
599
- |`optionA`|`Option<a>`|The first option|
600
- |`optionB`|`Option<a>`|The second option|
597
+ | param | type | description |
598
+ | --------- | ----------- | ----------------- |
599
+ | `optionA` | `Option<a>` | The first option |
600
+ | `optionB` | `Option<a>` | The second option |
601
601
 
602
602
  Returns:
603
603
 
604
- |type|description|
605
- |----|-----------|
606
- |`Option<a>`|The second Option if both are the `Some` variant or the first Option otherwise|
604
+ | type | description |
605
+ | ----------- | ------------------------------------------------------------------------------ |
606
+ | `Option<a>` | The second Option if both are the `Some` variant or the first Option otherwise |
607
607