@grain/stdlib 0.5.3 → 0.5.5

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 (77) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/array.gr +65 -57
  3. package/array.md +54 -6
  4. package/buffer.gr +71 -1
  5. package/buffer.md +142 -0
  6. package/bytes.gr +52 -3
  7. package/bytes.md +117 -0
  8. package/char.gr +23 -20
  9. package/char.md +18 -3
  10. package/immutablemap.gr +493 -0
  11. package/immutablemap.md +479 -0
  12. package/immutablepriorityqueue.gr +44 -16
  13. package/immutablepriorityqueue.md +44 -1
  14. package/immutableset.gr +498 -0
  15. package/immutableset.md +449 -0
  16. package/int32.gr +39 -37
  17. package/int32.md +6 -0
  18. package/int64.gr +39 -37
  19. package/int64.md +6 -0
  20. package/list.gr +33 -24
  21. package/list.md +39 -10
  22. package/map.gr +19 -28
  23. package/marshal.gr +4 -4
  24. package/number.gr +727 -26
  25. package/number.md +345 -23
  26. package/option.gr +30 -26
  27. package/option.md +12 -0
  28. package/package.json +1 -1
  29. package/path.gr +787 -0
  30. package/path.md +727 -0
  31. package/pervasives.gr +3 -4
  32. package/pervasives.md +6 -1
  33. package/priorityqueue.gr +25 -5
  34. package/priorityqueue.md +30 -0
  35. package/queue.gr +22 -7
  36. package/queue.md +18 -1
  37. package/regex.gr +161 -65
  38. package/regex.md +70 -0
  39. package/result.gr +24 -20
  40. package/result.md +12 -0
  41. package/runtime/atof/common.gr +198 -0
  42. package/runtime/atof/common.md +243 -0
  43. package/runtime/atof/decimal.gr +663 -0
  44. package/runtime/atof/decimal.md +59 -0
  45. package/runtime/atof/lemire.gr +264 -0
  46. package/runtime/atof/lemire.md +6 -0
  47. package/runtime/atof/parse.gr +615 -0
  48. package/runtime/atof/parse.md +12 -0
  49. package/runtime/atof/slow.gr +238 -0
  50. package/runtime/atof/slow.md +6 -0
  51. package/runtime/atof/table.gr +2016 -0
  52. package/runtime/atof/table.md +12 -0
  53. package/runtime/{stringUtils.gr → atoi/parse.gr} +1 -1
  54. package/runtime/{stringUtils.md → atoi/parse.md} +1 -1
  55. package/runtime/bigint.gr +7 -7
  56. package/runtime/compare.gr +2 -1
  57. package/runtime/equal.gr +3 -2
  58. package/runtime/exception.gr +9 -5
  59. package/runtime/exception.md +8 -2
  60. package/runtime/gc.gr +2 -1
  61. package/runtime/malloc.gr +1 -3
  62. package/runtime/numberUtils.gr +13 -13
  63. package/runtime/numberUtils.md +6 -0
  64. package/runtime/numbers.gr +123 -39
  65. package/runtime/numbers.md +26 -0
  66. package/runtime/string.gr +4 -2
  67. package/runtime/unsafe/conv.gr +21 -41
  68. package/runtime/unsafe/conv.md +0 -3
  69. package/runtime/unsafe/printWasm.gr +4 -40
  70. package/runtime/utils/printing.gr +3 -3
  71. package/set.gr +25 -25
  72. package/stack.gr +14 -0
  73. package/stack.md +17 -0
  74. package/string.gr +313 -39
  75. package/string.md +99 -0
  76. package/sys/file.gr +1 -1
  77. package/sys/time.gr +4 -4
package/number.md CHANGED
@@ -17,6 +17,32 @@ import Number from "number"
17
17
 
18
18
  Number constant values.
19
19
 
20
+ ### Number.**nan**
21
+
22
+ <details disabled>
23
+ <summary tabindex="-1">Added in <code>0.5.4</code></summary>
24
+ No other changes yet.
25
+ </details>
26
+
27
+ ```grain
28
+ nan : Number
29
+ ```
30
+
31
+ NaN represented as a Number value.
32
+
33
+ ### Number.**infinity**
34
+
35
+ <details disabled>
36
+ <summary tabindex="-1">Added in <code>0.5.4</code></summary>
37
+ No other changes yet.
38
+ </details>
39
+
40
+ ```grain
41
+ infinity : Number
42
+ ```
43
+
44
+ Infinity represented as a Number value.
45
+
20
46
  ### Number.**pi**
21
47
 
22
48
  <details disabled>
@@ -164,6 +190,57 @@ Returns:
164
190
  |----|-----------|
165
191
  |`Number`|The quotient of the two operands|
166
192
 
193
+ ### Number.**pow**
194
+
195
+ <details disabled>
196
+ <summary tabindex="-1">Added in <code>0.5.4</code></summary>
197
+ No other changes yet.
198
+ </details>
199
+
200
+ ```grain
201
+ pow : (Number, Number) -> Number
202
+ ```
203
+
204
+ Computes the exponentiation of the given base and power.
205
+
206
+ Parameters:
207
+
208
+ |param|type|description|
209
+ |-----|----|-----------|
210
+ |`base`|`Number`|The base number|
211
+ |`power`|`Number`|The exponent number|
212
+
213
+ Returns:
214
+
215
+ |type|description|
216
+ |----|-----------|
217
+ |`Number`|The base raised to the given power|
218
+
219
+ ### Number.**exp**
220
+
221
+ <details disabled>
222
+ <summary tabindex="-1">Added in <code>0.5.4</code></summary>
223
+ No other changes yet.
224
+ </details>
225
+
226
+ ```grain
227
+ exp : Number -> Number
228
+ ```
229
+
230
+ Computes the exponentiation of Euler's number to the given power.
231
+
232
+ Parameters:
233
+
234
+ |param|type|description|
235
+ |-----|----|-----------|
236
+ |`power`|`Number`|The exponent number|
237
+
238
+ Returns:
239
+
240
+ |type|description|
241
+ |----|-----------|
242
+ |`Number`|The `Number.e` value raised to the given power|
243
+
167
244
  ### Number.**sqrt**
168
245
 
169
246
  <details disabled>
@@ -225,9 +302,16 @@ Number.sign(0) == 0
225
302
 
226
303
  ### Number.**min**
227
304
 
228
- <details disabled>
229
- <summary tabindex="-1">Added in <code>0.4.0</code></summary>
230
- No other changes yet.
305
+ <details>
306
+ <summary>Added in <code>0.4.0</code></summary>
307
+ <table>
308
+ <thead>
309
+ <tr><th>version</th><th>changes</th></tr>
310
+ </thead>
311
+ <tbody>
312
+ <tr><td><code>0.5.4</code></td><td>Handle NaN properly</td></tr>
313
+ </tbody>
314
+ </table>
231
315
  </details>
232
316
 
233
317
  ```grain
@@ -251,9 +335,16 @@ Returns:
251
335
 
252
336
  ### Number.**max**
253
337
 
254
- <details disabled>
255
- <summary tabindex="-1">Added in <code>0.4.0</code></summary>
256
- No other changes yet.
338
+ <details>
339
+ <summary>Added in <code>0.4.0</code></summary>
340
+ <table>
341
+ <thead>
342
+ <tr><th>version</th><th>changes</th></tr>
343
+ </thead>
344
+ <tbody>
345
+ <tr><td><code>0.5.4</code></td><td>Handle NaN properly</td></tr>
346
+ </tbody>
347
+ </table>
257
348
  </details>
258
349
 
259
350
  ```grain
@@ -277,9 +368,16 @@ Returns:
277
368
 
278
369
  ### Number.**ceil**
279
370
 
280
- <details disabled>
281
- <summary tabindex="-1">Added in <code>0.4.0</code></summary>
282
- No other changes yet.
371
+ <details>
372
+ <summary>Added in <code>0.4.0</code></summary>
373
+ <table>
374
+ <thead>
375
+ <tr><th>version</th><th>changes</th></tr>
376
+ </thead>
377
+ <tbody>
378
+ <tr><td><code>0.5.4</code></td><td>Handle NaN and Infinity properly</td></tr>
379
+ </tbody>
380
+ </table>
283
381
  </details>
284
382
 
285
383
  ```grain
@@ -302,9 +400,16 @@ Returns:
302
400
 
303
401
  ### Number.**floor**
304
402
 
305
- <details disabled>
306
- <summary tabindex="-1">Added in <code>0.4.0</code></summary>
307
- No other changes yet.
403
+ <details>
404
+ <summary>Added in <code>0.4.0</code></summary>
405
+ <table>
406
+ <thead>
407
+ <tr><th>version</th><th>changes</th></tr>
408
+ </thead>
409
+ <tbody>
410
+ <tr><td><code>0.5.4</code></td><td>Handle NaN and Infinity properly</td></tr>
411
+ </tbody>
412
+ </table>
308
413
  </details>
309
414
 
310
415
  ```grain
@@ -327,9 +432,16 @@ Returns:
327
432
 
328
433
  ### Number.**trunc**
329
434
 
330
- <details disabled>
331
- <summary tabindex="-1">Added in <code>0.4.0</code></summary>
332
- No other changes yet.
435
+ <details>
436
+ <summary>Added in <code>0.4.0</code></summary>
437
+ <table>
438
+ <thead>
439
+ <tr><th>version</th><th>changes</th></tr>
440
+ </thead>
441
+ <tbody>
442
+ <tr><td><code>0.5.4</code></td><td>Handle NaN and Infinity properly</td></tr>
443
+ </tbody>
444
+ </table>
333
445
  </details>
334
446
 
335
447
  ```grain
@@ -352,9 +464,16 @@ Returns:
352
464
 
353
465
  ### Number.**round**
354
466
 
355
- <details disabled>
356
- <summary tabindex="-1">Added in <code>0.4.0</code></summary>
357
- No other changes yet.
467
+ <details>
468
+ <summary>Added in <code>0.4.0</code></summary>
469
+ <table>
470
+ <thead>
471
+ <tr><th>version</th><th>changes</th></tr>
472
+ </thead>
473
+ <tbody>
474
+ <tr><td><code>0.5.4</code></td><td>Handle NaN and Infinity properly</td></tr>
475
+ </tbody>
476
+ </table>
358
477
  </details>
359
478
 
360
479
  ```grain
@@ -610,13 +729,72 @@ Returns:
610
729
  |----|-----------|
611
730
  |`Result<Number, String>`|`Ok(value)` containing the parsed number on a successful parse or `Err(msg)` containing an error message string otherwise|
612
731
 
613
- ### Number.**sin**
732
+ ### Number.**parseFloat**
614
733
 
615
734
  <details disabled>
616
- <summary tabindex="-1">Added in <code>0.5.2</code></summary>
735
+ <summary tabindex="-1">Added in <code>0.5.5</code></summary>
617
736
  No other changes yet.
618
737
  </details>
619
738
 
739
+ ```grain
740
+ parseFloat : String -> Result<Number, String>
741
+ ```
742
+
743
+ Parses a string representation of a float into a `Number`. Underscores that appear
744
+ in numeric portions of the input are ignored.
745
+
746
+ Parameters:
747
+
748
+ |param|type|description|
749
+ |-----|----|-----------|
750
+ |`input`|`String`|The string to parse|
751
+
752
+ Returns:
753
+
754
+ |type|description|
755
+ |----|-----------|
756
+ |`Result<Number, String>`|`Ok(value)` containing the parsed number on a successful parse or `Err(msg)` containing an error message string otherwise|
757
+
758
+ ### Number.**parse**
759
+
760
+ <details disabled>
761
+ <summary tabindex="-1">Added in <code>0.5.5</code></summary>
762
+ No other changes yet.
763
+ </details>
764
+
765
+ ```grain
766
+ parse : String -> Result<Number, String>
767
+ ```
768
+
769
+ Parses a string representation of an integer, float, or rational into a `Number`.
770
+ Underscores that appear in the numeric portion of the input are ignored.
771
+
772
+ Parameters:
773
+
774
+ |param|type|description|
775
+ |-----|----|-----------|
776
+ |`input`|`String`|The string to parse|
777
+
778
+ Returns:
779
+
780
+ |type|description|
781
+ |----|-----------|
782
+ |`Result<Number, String>`|`Ok(value)` containing the parsed number on a successful parse or `Err(msg)` containing an error message string otherwise|
783
+
784
+ ### Number.**sin**
785
+
786
+ <details>
787
+ <summary>Added in <code>0.5.2</code></summary>
788
+ <table>
789
+ <thead>
790
+ <tr><th>version</th><th>changes</th></tr>
791
+ </thead>
792
+ <tbody>
793
+ <tr><td><code>0.5.4</code></td><td>Handle NaN and Infinity</td></tr>
794
+ </tbody>
795
+ </table>
796
+ </details>
797
+
620
798
  ```grain
621
799
  sin : Number -> Number
622
800
  ```
@@ -637,9 +815,16 @@ Returns:
637
815
 
638
816
  ### Number.**cos**
639
817
 
640
- <details disabled>
641
- <summary tabindex="-1">Added in <code>0.5.2</code></summary>
642
- No other changes yet.
818
+ <details>
819
+ <summary>Added in <code>0.5.2</code></summary>
820
+ <table>
821
+ <thead>
822
+ <tr><th>version</th><th>changes</th></tr>
823
+ </thead>
824
+ <tbody>
825
+ <tr><td><code>0.5.4</code></td><td>Handle NaN and Infinity</td></tr>
826
+ </tbody>
827
+ </table>
643
828
  </details>
644
829
 
645
830
  ```grain
@@ -660,3 +845,140 @@ Returns:
660
845
  |----|-----------|
661
846
  |`Number`|The computed cosine|
662
847
 
848
+ ### Number.**tan**
849
+
850
+ <details disabled>
851
+ <summary tabindex="-1">Added in <code>0.5.4</code></summary>
852
+ No other changes yet.
853
+ </details>
854
+
855
+ ```grain
856
+ tan : Number -> Number
857
+ ```
858
+
859
+ Computes the tangent of a number (in radians) using Chebyshev polynomials.
860
+
861
+ Parameters:
862
+
863
+ |param|type|description|
864
+ |-----|----|-----------|
865
+ |`radians`|`Number`|The input in radians|
866
+
867
+ Returns:
868
+
869
+ |type|description|
870
+ |----|-----------|
871
+ |`Number`|The computed tangent|
872
+
873
+ ### Number.**gamma**
874
+
875
+ <details disabled>
876
+ <summary tabindex="-1">Added in <code>0.5.4</code></summary>
877
+ No other changes yet.
878
+ </details>
879
+
880
+ ```grain
881
+ gamma : Number -> Number
882
+ ```
883
+
884
+ Computes the gamma function of a value using Lanczos approximation.
885
+
886
+ Parameters:
887
+
888
+ |param|type|description|
889
+ |-----|----|-----------|
890
+ |`z`|`Number`|The value to interpolate|
891
+
892
+ Returns:
893
+
894
+ |type|description|
895
+ |----|-----------|
896
+ |`Number`|The gamma of the given value|
897
+
898
+ Throws:
899
+
900
+ `InvalidArgument(String)`
901
+
902
+ * When `z` is zero
903
+
904
+ ### Number.**factorial**
905
+
906
+ <details disabled>
907
+ <summary tabindex="-1">Added in <code>0.5.4</code></summary>
908
+ No other changes yet.
909
+ </details>
910
+
911
+ ```grain
912
+ factorial : Number -> Number
913
+ ```
914
+
915
+ Computes the product of consecutive integers for an integer input and computes the gamma function for non-integer inputs.
916
+
917
+ Parameters:
918
+
919
+ |param|type|description|
920
+ |-----|----|-----------|
921
+ |`n`|`Number`|The value to factorialize|
922
+
923
+ Returns:
924
+
925
+ |type|description|
926
+ |----|-----------|
927
+ |`Number`|The factorial of the given value|
928
+
929
+ Throws:
930
+
931
+ `InvalidArgument(String)`
932
+
933
+ * When `n` is negative
934
+
935
+ ### Number.**toRadians**
936
+
937
+ <details disabled>
938
+ <summary tabindex="-1">Added in <code>0.5.4</code></summary>
939
+ No other changes yet.
940
+ </details>
941
+
942
+ ```grain
943
+ toRadians : Number -> Number
944
+ ```
945
+
946
+ Converts degrees to radians.
947
+
948
+ Parameters:
949
+
950
+ |param|type|description|
951
+ |-----|----|-----------|
952
+ |`degrees`|`Number`|The value to convert|
953
+
954
+ Returns:
955
+
956
+ |type|description|
957
+ |----|-----------|
958
+ |`Number`|The value in radians|
959
+
960
+ ### Number.**toDegrees**
961
+
962
+ <details disabled>
963
+ <summary tabindex="-1">Added in <code>0.5.4</code></summary>
964
+ No other changes yet.
965
+ </details>
966
+
967
+ ```grain
968
+ toDegrees : Number -> Number
969
+ ```
970
+
971
+ Converts radians to degrees.
972
+
973
+ Parameters:
974
+
975
+ |param|type|description|
976
+ |-----|----|-----------|
977
+ |`radians`|`Number`|The value to convert|
978
+
979
+ Returns:
980
+
981
+ |type|description|
982
+ |----|-----------|
983
+ |`Number`|The value in degrees|
984
+
package/option.gr CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @module Option: Utilities for working with the Option data type.
3
- *
3
+ *
4
4
  * The Option type is an enum that represents the possibility of something being present (with the `Some` variant), or not (with the `None` variant). There’s no standalone `null` or `nil` type in Grain; use an Option where you would normally reach for `null` or `nil`.
5
- *
5
+ *
6
6
  * @example import Option from "option"
7
- *
7
+ *
8
8
  * @example let hasValue = Some(1234) // Creates an Option containing 1234
9
9
  * @example let noValue = None // Creates an Option containing nothing
10
- *
10
+ *
11
11
  * @since v0.2.0
12
12
  */
13
13
 
@@ -20,7 +20,7 @@
20
20
  *
21
21
  * @param option: The option to check
22
22
  * @returns `true` if the Option is the `Some` variant or `false` otherwise
23
- *
23
+ *
24
24
  * @since v0.2.0
25
25
  */
26
26
  export let isSome = option => {
@@ -35,7 +35,7 @@ export let isSome = option => {
35
35
  *
36
36
  * @param option: The option to check
37
37
  * @returns `true` if the Option is the `None` variant or `false` otherwise
38
- *
38
+ *
39
39
  * @since v0.2.0
40
40
  */
41
41
  export let isNone = option => {
@@ -51,7 +51,7 @@ export let isNone = option => {
51
51
  * @param value: The value to search for
52
52
  * @param option: The option to search
53
53
  * @returns `true` if the Option is equivalent to `Some(value)` or `false` otherwise
54
- *
54
+ *
55
55
  * @since v0.2.0
56
56
  */
57
57
  export let contains = (value, option) => {
@@ -68,7 +68,9 @@ export let contains = (value, option) => {
68
68
  * @param msg: The message to use upon failure
69
69
  * @param option: The option to extract a value from
70
70
  * @returns The unwrapped value if the Option is the `Some` variant
71
- *
71
+ *
72
+ * @throws Failure(String): When the `option` is `None`
73
+ *
72
74
  * @since v0.2.0
73
75
  */
74
76
  export let expect = (msg, option) => {
@@ -79,12 +81,14 @@ export let expect = (msg, option) => {
79
81
  }
80
82
 
81
83
  /**
82
- * Extracts the value inside a `Some` option, otherwise
84
+ * Extracts the value inside a `Some` option, otherwise
83
85
  * throws an exception containing a default message.
84
86
  *
85
87
  * @param option: The option to extract the value from
86
88
  * @returns The unwrapped value if the Option is the `Some` variant
87
- *
89
+ *
90
+ * @throws Failure(String): When the `option` is `None`
91
+ *
88
92
  * @since v0.2.0
89
93
  */
90
94
  export let unwrap = option => {
@@ -97,7 +101,7 @@ export let unwrap = option => {
97
101
  * @param default: The default value
98
102
  * @param option: The option to unwrap
99
103
  * @returns The unwrapped value if the Option is the `Some` variant or the default value otherwise
100
- *
104
+ *
101
105
  * @since v0.2.0
102
106
  */
103
107
  export let unwrapWithDefault = (default, option) => {
@@ -113,7 +117,7 @@ export let unwrapWithDefault = (default, option) => {
113
117
  * @param fn: The function to call on the value of a `Some` variant
114
118
  * @param option: The option to map
115
119
  * @returns A new `Some` variant produced by the mapping function if the variant was `Some` or the unmodified `None` otherwise
116
- *
120
+ *
117
121
  * @since v0.2.0
118
122
  */
119
123
  export let map = (fn, option) => {
@@ -131,7 +135,7 @@ export let map = (fn, option) => {
131
135
  * @param default: A fallback value for a `None` variant
132
136
  * @param option: The option to map
133
137
  * @returns The value produced by the mapping function if the Option is of the `Some` variant or the default value otherwise
134
- *
138
+ *
135
139
  * @since v0.2.0
136
140
  */
137
141
  export let mapWithDefault = (fn, default, option) => {
@@ -150,7 +154,7 @@ export let mapWithDefault = (fn, default, option) => {
150
154
  * @param defaultFn: The default function
151
155
  * @param option: The option to map
152
156
  * @returns The value produced by one of the mapping functions
153
- *
157
+ *
154
158
  * @since v0.2.0
155
159
  */
156
160
  export let mapWithDefaultFn = (fn, defaultFn, option) => {
@@ -166,7 +170,7 @@ export let mapWithDefaultFn = (fn, defaultFn, option) => {
166
170
  * @param fn: The function to call on the value of a `Some` variant
167
171
  * @param option: The option to map
168
172
  * @returns A new Option produced by the mapping function if the variant was `Some` or the unmodified `None` otherwise
169
- *
173
+ *
170
174
  * @since v0.2.0
171
175
  */
172
176
  export let flatMap = (fn, option) => {
@@ -183,7 +187,7 @@ export let flatMap = (fn, option) => {
183
187
  * @param fn: The predicate function to indicate if the option should remain `Some`
184
188
  * @param option: The option to inspect
185
189
  * @returns `Some(value)` if the variant was `Some` and the predicate returns `true` or `None` otherwise
186
- *
190
+ *
187
191
  * @since v0.2.0
188
192
  */
189
193
  export let filter = (fn, option) => {
@@ -204,7 +208,7 @@ export let filter = (fn, option) => {
204
208
  * @param optionA: The first option to combine
205
209
  * @param optionB: The second option to combine
206
210
  * @returns `Some((valueA, valueB))` if both Options are `Some` variants or `None` otherwise
207
- *
211
+ *
208
212
  * @since v0.2.0
209
213
  */
210
214
  export let zip = (optionA, optionB) => {
@@ -221,7 +225,7 @@ export let zip = (optionA, optionB) => {
221
225
  * @param optionA: The first option to combine
222
226
  * @param optionB: The second option to combine
223
227
  * @returns `Some(newValue)` if both Options are `Some` variants or `None` otherwise
224
- *
228
+ *
225
229
  * @since v0.2.0
226
230
  */
227
231
  export let zipWith = (fn, optionA, optionB) => {
@@ -236,7 +240,7 @@ export let zipWith = (fn, optionA, optionB) => {
236
240
  *
237
241
  * @param option: The option to flatten
238
242
  * @returns `Some(innerValue)` if all nested options were the `Some` variant or `None` otherwise
239
- *
243
+ *
240
244
  * @example Option.flatten(Some(Some(1))) == Some(1)
241
245
  *
242
246
  * @since v0.2.0
@@ -253,7 +257,7 @@ export let flatten = option => {
253
257
  *
254
258
  * @param option: The option to convert
255
259
  * @returns `[value]` if the Option was the `Some` variant or `[]` otherwise
256
- *
260
+ *
257
261
  * @since v0.2.0
258
262
  */
259
263
  export let toList = option => {
@@ -268,7 +272,7 @@ export let toList = option => {
268
272
  *
269
273
  * @param option: The option to convert
270
274
  * @returns `[> value]` if the Option was the `Some` variant or `[> ]` otherwise
271
- *
275
+ *
272
276
  * @since v0.2.0
273
277
  */
274
278
  export let toArray = option => {
@@ -284,7 +288,7 @@ export let toArray = option => {
284
288
  * @param err: The error to use if the option is `None`
285
289
  * @param option: The option to convert
286
290
  * @returns `Ok(value)` if the Option is `Some(value)` or `Err(err)` if the Option is `None`
287
- *
291
+ *
288
292
  * @since v0.2.0
289
293
  */
290
294
  export let toResult = (err, option) => {
@@ -299,7 +303,7 @@ export let toResult = (err, option) => {
299
303
  *
300
304
  * @param fn: The function to call on the value of a `Some` variant
301
305
  * @param option: The option to inspect
302
- *
306
+ *
303
307
  * @since v0.2.0
304
308
  */
305
309
  export let sideEffect = (fn, option) => {
@@ -316,7 +320,7 @@ export let sideEffect = (fn, option) => {
316
320
  * @param fn: The function to call on the value of a `Some` variant
317
321
  * @param option: The option to inspect
318
322
  * @returns The unmodified option
319
- *
323
+ *
320
324
  * @since v0.2.0
321
325
  */
322
326
  export let peek = (fn, option) => {
@@ -330,7 +334,7 @@ export let peek = (fn, option) => {
330
334
  * @param optionA: The first option
331
335
  * @param optionB: The second option
332
336
  * @returns The first Option if it is the `Some` variant or the second Option otherwise
333
- *
337
+ *
334
338
  * @since v0.2.0
335
339
  */
336
340
  export let or = (optionA, optionB) => {
@@ -346,7 +350,7 @@ export let or = (optionA, optionB) => {
346
350
  * @param optionA: The first option
347
351
  * @param optionB: The second option
348
352
  * @returns The second Option if both are the `Some` variant or the first Option otherwise
349
- *
353
+ *
350
354
  * @since v0.2.0
351
355
  */
352
356
  export let and = (optionA, optionB) => {
package/option.md CHANGED
@@ -130,6 +130,12 @@ Returns:
130
130
  |----|-----------|
131
131
  |`a`|The unwrapped value if the Option is the `Some` variant|
132
132
 
133
+ Throws:
134
+
135
+ `Failure(String)`
136
+
137
+ * When the `option` is `None`
138
+
133
139
  ### Option.**unwrap**
134
140
 
135
141
  <details disabled>
@@ -156,6 +162,12 @@ Returns:
156
162
  |----|-----------|
157
163
  |`a`|The unwrapped value if the Option is the `Some` variant|
158
164
 
165
+ Throws:
166
+
167
+ `Failure(String)`
168
+
169
+ * When the `option` is `None`
170
+
159
171
  ### Option.**unwrapWithDefault**
160
172
 
161
173
  <details disabled>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grain/stdlib",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "The standard library for the Grain language.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://grain-lang.org",