@grain/stdlib 0.5.13 → 0.6.0

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 (155) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/LICENSE +1 -1
  3. package/README.md +25 -2
  4. package/array.gr +1512 -199
  5. package/array.md +2032 -94
  6. package/bigint.gr +239 -140
  7. package/bigint.md +450 -106
  8. package/buffer.gr +595 -102
  9. package/buffer.md +903 -145
  10. package/bytes.gr +401 -110
  11. package/bytes.md +551 -63
  12. package/char.gr +228 -49
  13. package/char.md +373 -7
  14. package/exception.gr +26 -12
  15. package/exception.md +29 -5
  16. package/float32.gr +130 -109
  17. package/float32.md +185 -57
  18. package/float64.gr +112 -99
  19. package/float64.md +185 -57
  20. package/hash.gr +47 -37
  21. package/hash.md +21 -3
  22. package/int16.gr +430 -0
  23. package/int16.md +618 -0
  24. package/int32.gr +200 -269
  25. package/int32.md +254 -289
  26. package/int64.gr +142 -225
  27. package/int64.md +254 -289
  28. package/int8.gr +511 -0
  29. package/int8.md +786 -0
  30. package/json.gr +2084 -0
  31. package/json.md +608 -0
  32. package/list.gr +120 -68
  33. package/list.md +125 -80
  34. package/map.gr +560 -57
  35. package/map.md +672 -56
  36. package/marshal.gr +239 -227
  37. package/marshal.md +36 -4
  38. package/number.gr +626 -676
  39. package/number.md +738 -153
  40. package/option.gr +33 -35
  41. package/option.md +58 -42
  42. package/package.json +2 -2
  43. package/path.gr +148 -187
  44. package/path.md +47 -96
  45. package/pervasives.gr +75 -416
  46. package/pervasives.md +85 -180
  47. package/priorityqueue.gr +433 -74
  48. package/priorityqueue.md +422 -54
  49. package/queue.gr +362 -80
  50. package/queue.md +433 -38
  51. package/random.gr +67 -75
  52. package/random.md +68 -40
  53. package/range.gr +135 -63
  54. package/range.md +198 -43
  55. package/rational.gr +284 -0
  56. package/rational.md +545 -0
  57. package/regex.gr +933 -1066
  58. package/regex.md +59 -60
  59. package/result.gr +23 -25
  60. package/result.md +54 -39
  61. package/runtime/atof/common.gr +78 -82
  62. package/runtime/atof/common.md +22 -10
  63. package/runtime/atof/decimal.gr +102 -127
  64. package/runtime/atof/decimal.md +28 -7
  65. package/runtime/atof/lemire.gr +56 -71
  66. package/runtime/atof/lemire.md +9 -1
  67. package/runtime/atof/parse.gr +83 -110
  68. package/runtime/atof/parse.md +12 -2
  69. package/runtime/atof/slow.gr +28 -35
  70. package/runtime/atof/slow.md +9 -1
  71. package/runtime/atof/table.gr +19 -18
  72. package/runtime/atof/table.md +10 -2
  73. package/runtime/atoi/parse.gr +153 -136
  74. package/runtime/atoi/parse.md +50 -1
  75. package/runtime/bigint.gr +410 -517
  76. package/runtime/bigint.md +71 -57
  77. package/runtime/compare.gr +176 -85
  78. package/runtime/compare.md +31 -1
  79. package/runtime/dataStructures.gr +144 -32
  80. package/runtime/dataStructures.md +267 -31
  81. package/runtime/debugPrint.gr +34 -15
  82. package/runtime/debugPrint.md +37 -5
  83. package/runtime/equal.gr +53 -52
  84. package/runtime/equal.md +30 -1
  85. package/runtime/exception.gr +38 -47
  86. package/runtime/exception.md +10 -8
  87. package/runtime/gc.gr +23 -152
  88. package/runtime/gc.md +13 -17
  89. package/runtime/malloc.gr +31 -31
  90. package/runtime/malloc.md +11 -3
  91. package/runtime/numberUtils.gr +191 -172
  92. package/runtime/numberUtils.md +17 -9
  93. package/runtime/numbers.gr +1695 -1021
  94. package/runtime/numbers.md +1098 -134
  95. package/runtime/string.gr +540 -242
  96. package/runtime/string.md +76 -6
  97. package/runtime/unsafe/constants.gr +30 -13
  98. package/runtime/unsafe/constants.md +80 -0
  99. package/runtime/unsafe/conv.gr +55 -28
  100. package/runtime/unsafe/conv.md +41 -9
  101. package/runtime/unsafe/memory.gr +10 -30
  102. package/runtime/unsafe/memory.md +15 -19
  103. package/runtime/unsafe/tags.gr +37 -21
  104. package/runtime/unsafe/tags.md +88 -8
  105. package/runtime/unsafe/wasmf32.gr +30 -36
  106. package/runtime/unsafe/wasmf32.md +64 -56
  107. package/runtime/unsafe/wasmf64.gr +30 -36
  108. package/runtime/unsafe/wasmf64.md +64 -56
  109. package/runtime/unsafe/wasmi32.gr +49 -66
  110. package/runtime/unsafe/wasmi32.md +102 -94
  111. package/runtime/unsafe/wasmi64.gr +52 -79
  112. package/runtime/unsafe/wasmi64.md +108 -100
  113. package/runtime/utils/printing.gr +13 -15
  114. package/runtime/utils/printing.md +11 -3
  115. package/runtime/wasi.gr +294 -295
  116. package/runtime/wasi.md +62 -42
  117. package/set.gr +574 -64
  118. package/set.md +634 -54
  119. package/stack.gr +181 -64
  120. package/stack.md +271 -42
  121. package/string.gr +453 -533
  122. package/string.md +241 -151
  123. package/uint16.gr +369 -0
  124. package/uint16.md +585 -0
  125. package/uint32.gr +470 -0
  126. package/uint32.md +737 -0
  127. package/uint64.gr +471 -0
  128. package/uint64.md +737 -0
  129. package/uint8.gr +369 -0
  130. package/uint8.md +585 -0
  131. package/uri.gr +1093 -0
  132. package/uri.md +477 -0
  133. package/{sys → wasi}/file.gr +914 -500
  134. package/{sys → wasi}/file.md +454 -50
  135. package/wasi/process.gr +292 -0
  136. package/{sys → wasi}/process.md +164 -6
  137. package/wasi/random.gr +77 -0
  138. package/wasi/random.md +80 -0
  139. package/{sys → wasi}/time.gr +15 -22
  140. package/{sys → wasi}/time.md +5 -5
  141. package/immutablearray.gr +0 -929
  142. package/immutablearray.md +0 -1038
  143. package/immutablemap.gr +0 -493
  144. package/immutablemap.md +0 -479
  145. package/immutablepriorityqueue.gr +0 -360
  146. package/immutablepriorityqueue.md +0 -291
  147. package/immutableset.gr +0 -498
  148. package/immutableset.md +0 -449
  149. package/runtime/debug.gr +0 -2
  150. package/runtime/debug.md +0 -6
  151. package/runtime/unsafe/errors.gr +0 -36
  152. package/runtime/unsafe/errors.md +0 -204
  153. package/sys/process.gr +0 -254
  154. package/sys/random.gr +0 -79
  155. package/sys/random.md +0 -66
package/regex.md CHANGED
@@ -10,12 +10,53 @@ No other changes yet.
10
10
  </details>
11
11
 
12
12
  ```grain
13
- import Regex from "regex"
13
+ from "regex" include Regex
14
14
  ```
15
15
 
16
+ ## Types
17
+
18
+ Type declarations included in the Regex module.
19
+
20
+ ### Regex.**RegularExpression**
21
+
22
+ ```grain
23
+ type RegularExpression
24
+ ```
25
+
26
+ ### Regex.**MatchResult**
27
+
28
+ <details disabled>
29
+ <summary tabindex="-1">Added in <code>0.4.3</code></summary>
30
+ No other changes yet.
31
+ </details>
32
+
33
+ ```grain
34
+ record MatchResult {
35
+ group: Number => Option<String>,
36
+ groupPosition: Number => Option<(Number, Number)>,
37
+ numGroups: Number,
38
+ allGroups: () => Array<Option<String>>,
39
+ allGroupPositions: () => Array<Option<(Number, Number)>>,
40
+ }
41
+ ```
42
+
43
+ This object contains the results
44
+ of a regular expression match. The results can be obtained using
45
+ the following accessors:
46
+
47
+ Fields:
48
+
49
+ |name|type|description|
50
+ |----|----|-----------|
51
+ |`group`|`Number => Option<String>`|Returns the contents of the given group. Note that group 0 contains<br/>the entire matched substring, and group 1 contains the first parenthesized group.|
52
+ |`groupPosition`|`Number => Option<(Number, Number)>`|Returns the position of the given group|
53
+ |`numGroups`|`Number`|Returns the number of defined groups in this match object (includes group 0)|
54
+ |`allGroups`|`() => Array<Option<String>>`|Returns the contents of all groups matched in this match object|
55
+ |`allGroupPositions`|`() => Array<Option<(Number, Number)>>`|Returns the positions of all groups matched in this match object|
56
+
16
57
  ## Values
17
58
 
18
- Functions for working with regular expressions.
59
+ Functions and constants included in the Regex module.
19
60
 
20
61
  ### Regex.**make**
21
62
 
@@ -25,7 +66,7 @@ No other changes yet.
25
66
  </details>
26
67
 
27
68
  ```grain
28
- make : String -> Result<RegularExpression, String>
69
+ make : (regexString: String) => Result<RegularExpression, String>
29
70
  ```
30
71
 
31
72
  Compiles the given pattern string into a regular expression object.
@@ -130,53 +171,6 @@ Examples:
130
171
  Regex.make("(foo|bar)[0-9]+")
131
172
  ```
132
173
 
133
- ### Regex.**MatchResult**
134
-
135
- ```grain
136
- record MatchResult {
137
- group: Number -> Option<String>,
138
- groupPosition: Number -> Option<(Number, Number)>,
139
- numGroups: Number,
140
- allGroups: () -> Array<Option<String>>,
141
- allGroupPositions: () -> Array<Option<(Number, Number)>>,
142
- }
143
- ```
144
-
145
- This object contains the results
146
- of a regular expression match. The results can be obtained using
147
- the following accessors:
148
-
149
- ```grain
150
- group : Number -> Option<String>
151
- ```
152
-
153
- Returns the contents of the given group. Note that group 0 contains
154
- the entire matched substring, and group 1 contains the first parenthesized group.
155
-
156
- ```grain
157
- groupPosition : Number -> Option<(Number, Number)>
158
- ```
159
-
160
- Returns the position of the given group.
161
-
162
- ```grain
163
- numGroups : Number
164
- ```
165
-
166
- The number of defined groups in this match object (including group 0).
167
-
168
- ```grain
169
- allGroups : () -> Array<Option<String>>
170
- ```
171
-
172
- Returns the contents of all groups matched in this match object.
173
-
174
- ```grain
175
- allGroupPositions : () -> Array<Option<(Number, Number)>>
176
- ```
177
-
178
- Returns the positions of all groups matched in this match object.
179
-
180
174
  ### Regex.**isMatch**
181
175
 
182
176
  <details disabled>
@@ -185,7 +179,7 @@ No other changes yet.
185
179
  </details>
186
180
 
187
181
  ```grain
188
- isMatch : (RegularExpression, String) -> Bool
182
+ isMatch : (rx: RegularExpression, string: String) => Bool
189
183
  ```
190
184
 
191
185
  Determines if the given regular expression has a match in the given string.
@@ -217,7 +211,8 @@ No other changes yet.
217
211
  </details>
218
212
 
219
213
  ```grain
220
- isMatchRange : (RegularExpression, String, Number, Number) -> Bool
214
+ isMatchRange :
215
+ (rx: RegularExpression, string: String, start: Number, end: Number) => Bool
221
216
  ```
222
217
 
223
218
  Determines if the given regular expression has a match in the given string between the given start/end offsets.
@@ -255,7 +250,7 @@ No other changes yet.
255
250
  </details>
256
251
 
257
252
  ```grain
258
- find : (RegularExpression, String) -> Option<MatchResult>
253
+ find : (rx: RegularExpression, string: String) => Option<MatchResult>
259
254
  ```
260
255
 
261
256
  Returns the first match for the given regular expression contained within the given string.
@@ -288,7 +283,8 @@ No other changes yet.
288
283
 
289
284
  ```grain
290
285
  findRange :
291
- (RegularExpression, String, Number, Number) -> Option<MatchResult>
286
+ (rx: RegularExpression, string: String, start: Number, end: Number) =>
287
+ Option<MatchResult>
292
288
  ```
293
289
 
294
290
  Returns the first match for the given regular expression contained within the given string
@@ -318,7 +314,7 @@ Regex.findRange(Result.unwrap(Regex.make("ca+[at]")), "caaat", 0, 5)
318
314
  ### Regex.**findAll**
319
315
 
320
316
  ```grain
321
- findAll : (RegularExpression, String) -> List<MatchResult>
317
+ findAll : (rx: RegularExpression, string: String) => List<MatchResult>
322
318
  ```
323
319
 
324
320
  Returns all matches for the given regular expression contained within the given string.
@@ -345,7 +341,8 @@ No other changes yet.
345
341
 
346
342
  ```grain
347
343
  findAllRange :
348
- (RegularExpression, String, Number, Number) -> List<MatchResult>
344
+ (rx: RegularExpression, string: String, start: Number, end: Number) =>
345
+ List<MatchResult>
349
346
  ```
350
347
 
351
348
  Returns all matches for the given regular expression contained within the given string
@@ -380,7 +377,8 @@ No other changes yet.
380
377
  </details>
381
378
 
382
379
  ```grain
383
- replace : (RegularExpression, String, String) -> String
380
+ replace :
381
+ (rx: RegularExpression, toSearch: String, replacement: String) => String
384
382
  ```
385
383
 
386
384
  Replaces the first match for the given regular expression contained within the given string with the specified replacement.
@@ -421,7 +419,8 @@ No other changes yet.
421
419
  </details>
422
420
 
423
421
  ```grain
424
- replaceAll : (RegularExpression, String, String) -> String
422
+ replaceAll :
423
+ (rx: RegularExpression, toSearch: String, replacement: String) => String
425
424
  ```
426
425
 
427
426
  Replaces all matches for the given regular expression contained within the given string with the specified replacement.
@@ -455,7 +454,7 @@ No other changes yet.
455
454
  </details>
456
455
 
457
456
  ```grain
458
- split : (RegularExpression, String) -> List<String>
457
+ split : (rx: RegularExpression, str: String) => List<String>
459
458
  ```
460
459
 
461
460
  Splits the given string at the first match for the given regular expression.
@@ -490,7 +489,7 @@ No other changes yet.
490
489
  </details>
491
490
 
492
491
  ```grain
493
- splitAll : (RegularExpression, String) -> List<String>
492
+ splitAll : (rx: RegularExpression, str: String) => List<String>
494
493
  ```
495
494
 
496
495
  Splits the given string at every match for the given regular expression.
package/result.gr CHANGED
@@ -1,21 +1,17 @@
1
1
  /**
2
- * @module Result: Utilities for working with the Result data type.
2
+ * Utilities for working with the Result data type.
3
3
  *
4
4
  * The Result type is an enum that represents the possibility of a success case (with the `Ok` variant),
5
5
  * or an error case (with the `Err` variant). Use a Result as the return type of a function that may return an error.
6
6
  *
7
- * @example import Result from "result"
8
- *
7
+ * @example from "result" include Result
9
8
  *
10
9
  * @example let success = Ok((x) => 1 + x) // Creates a successful Result containing (x) => 1 + x
11
10
  * @example let failure = Err("Something bad happened") // Creates an unsuccessful Result containing "Something bad happened"
12
11
  *
13
12
  * @since v0.2.0
14
13
  */
15
-
16
- /**
17
- * @section Values: Functions for working with the Result data type.
18
- */
14
+ module Result
19
15
 
20
16
  /**
21
17
  * Checks if the Result is the `Ok` variant.
@@ -25,7 +21,7 @@
25
21
  *
26
22
  * @since v0.2.0
27
23
  */
28
- export let isOk = result => {
24
+ provide let isOk = result => {
29
25
  match (result) {
30
26
  Ok(_) => true,
31
27
  _ => false,
@@ -40,7 +36,7 @@ export let isOk = result => {
40
36
  *
41
37
  * @since v0.2.0
42
38
  */
43
- export let isErr = result => !isOk(result)
39
+ provide let isErr = result => !isOk(result)
44
40
 
45
41
  /**
46
42
  * Converts the Result to an Option. An error value is discarded and replaced with `None`.
@@ -50,7 +46,7 @@ export let isErr = result => !isOk(result)
50
46
  *
51
47
  * @since v0.2.0
52
48
  */
53
- export let toOption = result => {
49
+ provide let toOption = result => {
54
50
  match (result) {
55
51
  Ok(x) => Some(x),
56
52
  _ => None,
@@ -66,7 +62,7 @@ export let toOption = result => {
66
62
  *
67
63
  * @since v0.2.0
68
64
  */
69
- export let flatMap = (fn, result) => {
65
+ provide let flatMap = (fn, result) => {
70
66
  match (result) {
71
67
  Ok(x) => fn(x),
72
68
  Err(e) => Err(e),
@@ -82,7 +78,7 @@ export let flatMap = (fn, result) => {
82
78
  *
83
79
  * @since v0.2.0
84
80
  */
85
- export let flatMapErr = (fn, result) => {
81
+ provide let flatMapErr = (fn, result) => {
86
82
  match (result) {
87
83
  Err(e) => fn(e),
88
84
  Ok(x) => Ok(x),
@@ -98,7 +94,7 @@ export let flatMapErr = (fn, result) => {
98
94
  *
99
95
  * @since v0.2.0
100
96
  */
101
- export let map = (fn, result) => {
97
+ provide let map = (fn, result) => {
102
98
  match (result) {
103
99
  Ok(x) => Ok(fn(x)),
104
100
  Err(e) => Err(e),
@@ -114,7 +110,7 @@ export let map = (fn, result) => {
114
110
  *
115
111
  * @since v0.2.0
116
112
  */
117
- export let mapErr = (fn, result) => {
113
+ provide let mapErr = (fn, result) => {
118
114
  match (result) {
119
115
  Err(e) => Err(fn(e)),
120
116
  Ok(x) => Ok(x),
@@ -132,7 +128,7 @@ export let mapErr = (fn, result) => {
132
128
  *
133
129
  * @since v0.2.0
134
130
  */
135
- export let mapWithDefault = (fn, def, result) => {
131
+ provide let mapWithDefault = (fn, def, result) => {
136
132
  match (result) {
137
133
  Ok(a) => fn(a),
138
134
  _ => def,
@@ -151,7 +147,7 @@ export let mapWithDefault = (fn, def, result) => {
151
147
  *
152
148
  * @since v0.2.0
153
149
  */
154
- export let mapWithDefaultFn = (fnOk, fnErr, result) => {
150
+ provide let mapWithDefaultFn = (fnOk, fnErr, result) => {
155
151
  match (result) {
156
152
  Ok(a) => fnOk(a),
157
153
  Err(a) => fnErr(a),
@@ -165,9 +161,10 @@ export let mapWithDefaultFn = (fnOk, fnErr, result) => {
165
161
  * @param result2: The second result
166
162
  * @returns The first Result if it is the `Ok` variant or the second Result otherwise
167
163
  *
168
- * @since v0.2.0
164
+ * @since v0.6.0
165
+ * @history v0.2.0: Originally named `or`
169
166
  */
170
- export let or = (result1, result2) => {
167
+ provide let (||) = (result1, result2) => {
171
168
  match (result1) {
172
169
  Ok(x) => result1,
173
170
  _ => result2,
@@ -181,9 +178,10 @@ export let or = (result1, result2) => {
181
178
  * @param result2: The second result
182
179
  * @returns The second Result if both are the `Ok` variant or the first Result otherwise
183
180
  *
184
- * @since v0.2.0
181
+ * @since v0.6.0
182
+ * @history v0.2.0: Originally named `and`
185
183
  */
186
- export let and = (result1, result2) => {
184
+ provide let (&&) = (result1, result2) => {
187
185
  match (result1) {
188
186
  Ok(_) => result2,
189
187
  Err(_) => result1,
@@ -201,7 +199,7 @@ export let and = (result1, result2) => {
201
199
  *
202
200
  * @since v0.2.0
203
201
  */
204
- export let peek = (fnOk, fnErr, result) => {
202
+ provide let peek = (fnOk, fnErr, result) => {
205
203
  match (result) {
206
204
  Ok(x) => ignore(fnOk(x)),
207
205
  Err(x) => ignore(fnErr(x)),
@@ -216,7 +214,7 @@ export let peek = (fnOk, fnErr, result) => {
216
214
  *
217
215
  * @since v0.2.0
218
216
  */
219
- export let peekOk = (fn, result) => {
217
+ provide let peekOk = (fn, result) => {
220
218
  peek(fn, identity, result)
221
219
  }
222
220
 
@@ -228,7 +226,7 @@ export let peekOk = (fn, result) => {
228
226
  *
229
227
  * @since v0.2.0
230
228
  */
231
- export let peekErr = (fn, result) => {
229
+ provide let peekErr = (fn, result) => {
232
230
  peek(identity, fn, result)
233
231
  }
234
232
 
@@ -246,7 +244,7 @@ export let peekErr = (fn, result) => {
246
244
  *
247
245
  * @since v0.4.0
248
246
  */
249
- export let expect = (msg, result) => {
247
+ provide let expect = (msg, result) => {
250
248
  match (result) {
251
249
  Ok(x) => x,
252
250
  Err(err) => fail msg ++ ": " ++ toString(err),
@@ -266,6 +264,6 @@ export let expect = (msg, result) => {
266
264
  *
267
265
  * @since v0.4.0
268
266
  */
269
- export let unwrap = result => {
267
+ provide let unwrap = result => {
270
268
  expect("Could not unwrap Err value", result)
271
269
  }
package/result.md CHANGED
@@ -13,7 +13,7 @@ No other changes yet.
13
13
  </details>
14
14
 
15
15
  ```grain
16
- import Result from "result"
16
+ from "result" include Result
17
17
  ```
18
18
 
19
19
  ```grain
@@ -26,7 +26,7 @@ let failure = Err("Something bad happened") // Creates an unsuccessful Result co
26
26
 
27
27
  ## Values
28
28
 
29
- Functions for working with the Result data type.
29
+ Functions and constants included in the Result module.
30
30
 
31
31
  ### Result.**isOk**
32
32
 
@@ -36,7 +36,7 @@ No other changes yet.
36
36
  </details>
37
37
 
38
38
  ```grain
39
- isOk : Result<a, b> -> Bool
39
+ isOk : (result: Result<a, b>) => Bool
40
40
  ```
41
41
 
42
42
  Checks if the Result is the `Ok` variant.
@@ -61,7 +61,7 @@ No other changes yet.
61
61
  </details>
62
62
 
63
63
  ```grain
64
- isErr : Result<a, b> -> Bool
64
+ isErr : (result: Result<a, b>) => Bool
65
65
  ```
66
66
 
67
67
  Checks if the Result is the `Err` variant.
@@ -86,7 +86,7 @@ No other changes yet.
86
86
  </details>
87
87
 
88
88
  ```grain
89
- toOption : Result<a, b> -> Option<a>
89
+ toOption : (result: Result<a, b>) => Option<a>
90
90
  ```
91
91
 
92
92
  Converts the Result to an Option. An error value is discarded and replaced with `None`.
@@ -111,7 +111,7 @@ No other changes yet.
111
111
  </details>
112
112
 
113
113
  ```grain
114
- flatMap : ((a -> Result<b, c>), Result<a, c>) -> Result<b, c>
114
+ flatMap : (fn: (a => Result<b, c>), result: Result<a, c>) => Result<b, c>
115
115
  ```
116
116
 
117
117
  If the Result is `Ok(value)`, applies the given function to the `value` to produce a new Result.
@@ -120,7 +120,7 @@ Parameters:
120
120
 
121
121
  |param|type|description|
122
122
  |-----|----|-----------|
123
- |`fn`|`a -> Result<b, c>`|The function to call on the value of an `Ok` variant|
123
+ |`fn`|`a => Result<b, c>`|The function to call on the value of an `Ok` variant|
124
124
  |`result`|`Result<a, c>`|The result to map|
125
125
 
126
126
  Returns:
@@ -137,7 +137,7 @@ No other changes yet.
137
137
  </details>
138
138
 
139
139
  ```grain
140
- flatMapErr : ((a -> Result<b, c>), Result<b, a>) -> Result<b, c>
140
+ flatMapErr : (fn: (a => Result<b, c>), result: Result<b, a>) => Result<b, c>
141
141
  ```
142
142
 
143
143
  If the Result is an `Err(value)`, applies the given function to the `value` to produce a new Result.
@@ -146,7 +146,7 @@ Parameters:
146
146
 
147
147
  |param|type|description|
148
148
  |-----|----|-----------|
149
- |`fn`|`a -> Result<b, c>`|The function to call on the value of an `Err` variant|
149
+ |`fn`|`a => Result<b, c>`|The function to call on the value of an `Err` variant|
150
150
  |`result`|`Result<b, a>`|The result to map|
151
151
 
152
152
  Returns:
@@ -163,7 +163,7 @@ No other changes yet.
163
163
  </details>
164
164
 
165
165
  ```grain
166
- map : ((a -> b), Result<a, c>) -> Result<b, c>
166
+ map : (fn: (a => b), result: Result<a, c>) => Result<b, c>
167
167
  ```
168
168
 
169
169
  If the Result is `Ok(value)`, applies the given function to the `value` and wraps the new value in an `Ok` variant.
@@ -172,7 +172,7 @@ Parameters:
172
172
 
173
173
  |param|type|description|
174
174
  |-----|----|-----------|
175
- |`fn`|`a -> b`|The function to call on the value of an `Ok` variant|
175
+ |`fn`|`a => b`|The function to call on the value of an `Ok` variant|
176
176
  |`result`|`Result<a, c>`|The result to map|
177
177
 
178
178
  Returns:
@@ -189,7 +189,7 @@ No other changes yet.
189
189
  </details>
190
190
 
191
191
  ```grain
192
- mapErr : ((a -> b), Result<c, a>) -> Result<c, b>
192
+ mapErr : (fn: (a => b), result: Result<c, a>) => Result<c, b>
193
193
  ```
194
194
 
195
195
  If the Result is `Err(value)`, applies the given function to the `value` and wraps the new value in an `Err` variant.
@@ -198,7 +198,7 @@ Parameters:
198
198
 
199
199
  |param|type|description|
200
200
  |-----|----|-----------|
201
- |`fn`|`a -> b`|The function to call on the value of an `Err` variant|
201
+ |`fn`|`a => b`|The function to call on the value of an `Err` variant|
202
202
  |`result`|`Result<c, a>`|The result to map|
203
203
 
204
204
  Returns:
@@ -215,7 +215,7 @@ No other changes yet.
215
215
  </details>
216
216
 
217
217
  ```grain
218
- mapWithDefault : ((a -> b), b, Result<a, c>) -> b
218
+ mapWithDefault : (fn: (a => b), def: b, result: Result<a, c>) => b
219
219
  ```
220
220
 
221
221
  If the Result is `Ok(value)`, applies the given function to the `value` to produce a new value, otherwise uses the default value.
@@ -225,7 +225,7 @@ Parameters:
225
225
 
226
226
  |param|type|description|
227
227
  |-----|----|-----------|
228
- |`fn`|`a -> b`|The function to call on the value of an `Ok` variant|
228
+ |`fn`|`a => b`|The function to call on the value of an `Ok` variant|
229
229
  |`def`|`b`|A fallback value for an `Err` variant|
230
230
  |`result`|`Result<a, c>`|The result to map|
231
231
 
@@ -243,7 +243,8 @@ No other changes yet.
243
243
  </details>
244
244
 
245
245
  ```grain
246
- mapWithDefaultFn : ((a -> b), (c -> b), Result<a, c>) -> b
246
+ mapWithDefaultFn :
247
+ (fnOk: (a => b), fnErr: (c => b), result: Result<a, c>) => b
247
248
  ```
248
249
 
249
250
  If the Result is `Ok(value)`, applies the `fnOk` function to the `value` to produce a new value.
@@ -254,8 +255,8 @@ Parameters:
254
255
 
255
256
  |param|type|description|
256
257
  |-----|----|-----------|
257
- |`fnOk`|`a -> b`|The function to call on the value of an `Ok` variant|
258
- |`fnErr`|`c -> b`|The function to call on the value of an `Err` variant|
258
+ |`fnOk`|`a => b`|The function to call on the value of an `Ok` variant|
259
+ |`fnErr`|`c => b`|The function to call on the value of an `Err` variant|
259
260
  |`result`|`Result<a, c>`|The result to map|
260
261
 
261
262
  Returns:
@@ -264,15 +265,22 @@ Returns:
264
265
  |----|-----------|
265
266
  |`b`|The value produced by one of the mapping functions|
266
267
 
267
- ### Result.**or**
268
-
269
- <details disabled>
270
- <summary tabindex="-1">Added in <code>0.2.0</code></summary>
271
- No other changes yet.
268
+ ### Result.**(||)**
269
+
270
+ <details>
271
+ <summary>Added in <code>0.6.0</code></summary>
272
+ <table>
273
+ <thead>
274
+ <tr><th>version</th><th>changes</th></tr>
275
+ </thead>
276
+ <tbody>
277
+ <tr><td><code>0.2.0</code></td><td>Originally named `or`</td></tr>
278
+ </tbody>
279
+ </table>
272
280
  </details>
273
281
 
274
282
  ```grain
275
- or : (Result<a, b>, Result<a, b>) -> Result<a, b>
283
+ (||) : (result1: Result<a, b>, result2: Result<a, b>) => Result<a, b>
276
284
  ```
277
285
 
278
286
  Behaves like a logical OR (`||`) where the first Result is only returned if it is the `Ok` variant and falling back to the second Result in all other cases.
@@ -290,15 +298,22 @@ Returns:
290
298
  |----|-----------|
291
299
  |`Result<a, b>`|The first Result if it is the `Ok` variant or the second Result otherwise|
292
300
 
293
- ### Result.**and**
294
-
295
- <details disabled>
296
- <summary tabindex="-1">Added in <code>0.2.0</code></summary>
297
- No other changes yet.
301
+ ### Result.**(&&)**
302
+
303
+ <details>
304
+ <summary>Added in <code>0.6.0</code></summary>
305
+ <table>
306
+ <thead>
307
+ <tr><th>version</th><th>changes</th></tr>
308
+ </thead>
309
+ <tbody>
310
+ <tr><td><code>0.2.0</code></td><td>Originally named `and`</td></tr>
311
+ </tbody>
312
+ </table>
298
313
  </details>
299
314
 
300
315
  ```grain
301
- and : (Result<a, b>, Result<a, b>) -> Result<a, b>
316
+ (&&) : (result1: Result<a, b>, result2: Result<a, b>) => Result<a, b>
302
317
  ```
303
318
 
304
319
  Behaves like a logical AND (`&&`) where the first Result is only returned if it is the `Err` variant and falling back to the second Result in all other cases.
@@ -324,7 +339,7 @@ No other changes yet.
324
339
  </details>
325
340
 
326
341
  ```grain
327
- peek : ((a -> b), (c -> d), Result<a, c>) -> Void
342
+ peek : (fnOk: (a => b), fnErr: (c => d), result: Result<a, c>) => Void
328
343
  ```
329
344
 
330
345
  If the Result is `Ok(value)`, applies the `fnOk` function to the `value` without producing a new value.
@@ -335,8 +350,8 @@ Parameters:
335
350
 
336
351
  |param|type|description|
337
352
  |-----|----|-----------|
338
- |`fnOk`|`a -> b`|The function to call on the value of an `Ok` variant|
339
- |`fnErr`|`c -> d`|The function to call on the value of an `Err` variant|
353
+ |`fnOk`|`a => b`|The function to call on the value of an `Ok` variant|
354
+ |`fnErr`|`c => d`|The function to call on the value of an `Err` variant|
340
355
  |`result`|`Result<a, c>`|The result to inspect|
341
356
 
342
357
  ### Result.**peekOk**
@@ -347,7 +362,7 @@ No other changes yet.
347
362
  </details>
348
363
 
349
364
  ```grain
350
- peekOk : ((a -> b), Result<a, c>) -> Void
365
+ peekOk : (fn: (a => b), result: Result<a, c>) => Void
351
366
  ```
352
367
 
353
368
  If the Result is `Ok(value)`, applies the given function to the `value` without producing a new value.
@@ -356,7 +371,7 @@ Parameters:
356
371
 
357
372
  |param|type|description|
358
373
  |-----|----|-----------|
359
- |`fn`|`a -> b`|The function to call on the value of an `Ok` variant|
374
+ |`fn`|`a => b`|The function to call on the value of an `Ok` variant|
360
375
  |`result`|`Result<a, c>`|The result to inspect|
361
376
 
362
377
  ### Result.**peekErr**
@@ -367,7 +382,7 @@ No other changes yet.
367
382
  </details>
368
383
 
369
384
  ```grain
370
- peekErr : ((a -> b), Result<c, a>) -> Void
385
+ peekErr : (fn: (a => b), result: Result<c, a>) => Void
371
386
  ```
372
387
 
373
388
  If the Result is `Err(value)`, applies the given function to the `value` without producing a new value.
@@ -376,7 +391,7 @@ Parameters:
376
391
 
377
392
  |param|type|description|
378
393
  |-----|----|-----------|
379
- |`fn`|`a -> b`|The function to call on the value of an `Err` variant|
394
+ |`fn`|`a => b`|The function to call on the value of an `Err` variant|
380
395
  |`result`|`Result<c, a>`|The result to inspect|
381
396
 
382
397
  ### Result.**expect**
@@ -387,7 +402,7 @@ No other changes yet.
387
402
  </details>
388
403
 
389
404
  ```grain
390
- expect : (String, Result<a, b>) -> a
405
+ expect : (msg: String, result: Result<a, b>) => a
391
406
  ```
392
407
 
393
408
  Extracts the value inside an `Ok` result, otherwise throw an
@@ -426,7 +441,7 @@ No other changes yet.
426
441
  </details>
427
442
 
428
443
  ```grain
429
- unwrap : Result<a, b> -> a
444
+ unwrap : (result: Result<a, b>) => a
430
445
  ```
431
446
 
432
447
  Extracts the value inside an `Ok` result, otherwise throw an