@grain/stdlib 0.6.5 → 0.7.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 (139) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/LICENSE +1 -1
  3. package/README.md +2 -2
  4. package/array.gr +55 -7
  5. package/array.md +123 -77
  6. package/bigint.md +30 -30
  7. package/buffer.gr +20 -53
  8. package/buffer.md +47 -47
  9. package/bytes.gr +111 -35
  10. package/bytes.md +111 -32
  11. package/char.gr +201 -99
  12. package/char.md +361 -34
  13. package/exception.gr +11 -11
  14. package/exception.md +26 -1
  15. package/float32.gr +327 -3
  16. package/float32.md +606 -19
  17. package/float64.gr +320 -3
  18. package/float64.md +606 -19
  19. package/fs.gr +1082 -0
  20. package/fs.md +630 -0
  21. package/hash.gr +142 -88
  22. package/hash.md +102 -14
  23. package/int16.md +23 -23
  24. package/int32.gr +25 -4
  25. package/int32.md +65 -30
  26. package/int64.gr +26 -1
  27. package/int64.md +65 -30
  28. package/int8.md +23 -23
  29. package/json.gr +366 -51
  30. package/json.md +418 -2
  31. package/list.gr +387 -49
  32. package/list.md +492 -69
  33. package/map.gr +20 -12
  34. package/map.md +44 -38
  35. package/marshal.gr +41 -40
  36. package/marshal.md +2 -2
  37. package/number.gr +159 -30
  38. package/number.md +215 -38
  39. package/option.md +21 -21
  40. package/package.json +5 -3
  41. package/path.gr +48 -0
  42. package/path.md +103 -12
  43. package/pervasives.gr +2 -2
  44. package/pervasives.md +37 -37
  45. package/priorityqueue.gr +7 -7
  46. package/priorityqueue.md +19 -19
  47. package/queue.gr +183 -29
  48. package/queue.md +296 -40
  49. package/random.md +6 -6
  50. package/range.gr +4 -4
  51. package/range.md +6 -6
  52. package/rational.md +16 -16
  53. package/regex.gr +52 -51
  54. package/regex.md +11 -11
  55. package/result.md +16 -16
  56. package/runtime/atof/common.md +39 -39
  57. package/runtime/atof/decimal.gr +6 -6
  58. package/runtime/atof/decimal.md +8 -8
  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 +1 -1
  71. package/runtime/dataStructures.md +33 -33
  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 +1 -1
  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 +4 -4
  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 +79 -73
  98. package/runtime/string.gr +37 -105
  99. package/runtime/string.md +3 -9
  100. package/runtime/unsafe/constants.md +24 -24
  101. package/runtime/unsafe/conv.md +13 -13
  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 +138 -138
  117. package/set.gr +18 -11
  118. package/set.md +42 -36
  119. package/stack.gr +171 -2
  120. package/stack.md +297 -15
  121. package/string.gr +352 -557
  122. package/string.md +77 -34
  123. package/uint16.gr +81 -0
  124. package/uint16.md +183 -22
  125. package/uint32.gr +25 -4
  126. package/uint32.md +63 -28
  127. package/uint64.gr +25 -5
  128. package/uint64.md +63 -28
  129. package/uint8.gr +81 -0
  130. package/uint8.md +183 -22
  131. package/uri.gr +57 -53
  132. package/uri.md +11 -12
  133. package/wasi/file.gr +67 -59
  134. package/wasi/file.md +39 -39
  135. package/wasi/process.md +5 -5
  136. package/wasi/random.md +3 -3
  137. package/wasi/time.md +4 -4
  138. package/runtime/utils/printing.gr +0 -60
  139. package/runtime/utils/printing.md +0 -26
package/uint8.gr CHANGED
@@ -2,6 +2,9 @@
2
2
  * Utilities for working with the Uint8 type.
3
3
  * @example from "uint8" include Uint8
4
4
  *
5
+ * @example 1us
6
+ * @example 10us
7
+ *
5
8
  * @since v0.6.0
6
9
  */
7
10
  module Uint8
@@ -33,6 +36,9 @@ provide { fromNumber, toNumber }
33
36
  * @param number: The value to convert
34
37
  * @returns The Int8 represented as a Uint8
35
38
  *
39
+ * @example Uint8.fromInt8(1s) == 1us
40
+ * @example Uint8.fromInt8(-1s) == 255us
41
+ *
36
42
  * @since v0.6.0
37
43
  */
38
44
  @unsafe
@@ -49,6 +55,8 @@ provide let fromInt8 = (number: Int8) => {
49
55
  * @param value: The value to increment
50
56
  * @returns The incremented value
51
57
  *
58
+ * @example Uint8.incr(1us) == 2us
59
+ *
52
60
  * @since v0.6.0
53
61
  */
54
62
  @unsafe
@@ -65,6 +73,9 @@ provide let incr = (value: Uint8) => {
65
73
  * @param value: The value to decrement
66
74
  * @returns The decremented value
67
75
  *
76
+ * @example Uint8.decr(1us) == 0us
77
+ * @example Uint8.decr(0us) == 255us
78
+ *
68
79
  * @since v0.6.0
69
80
  */
70
81
  @unsafe
@@ -82,6 +93,10 @@ provide let decr = (value: Uint8) => {
82
93
  * @param y: The second operand
83
94
  * @returns The sum of the two operands
84
95
  *
96
+ * @example
97
+ * use Uint8.{ (+) }
98
+ * assert 1us + 1us == 2us
99
+ *
85
100
  * @since v0.6.0
86
101
  */
87
102
  @unsafe
@@ -103,6 +118,10 @@ provide let (+) = (x: Uint8, y: Uint8) => {
103
118
  * @param y: The second operand
104
119
  * @returns The difference of the two operands
105
120
  *
121
+ * @example
122
+ * use Uint8.{ (-) }
123
+ * assert 2us - 1us == 1us
124
+ *
106
125
  * @since v0.6.0
107
126
  */
108
127
  @unsafe
@@ -121,6 +140,10 @@ provide let (-) = (x: Uint8, y: Uint8) => {
121
140
  * @param y: The second operand
122
141
  * @returns The product of the two operands
123
142
  *
143
+ * @example
144
+ * use Uint8.{ (*) }
145
+ * assert 2us * 2us == 4us
146
+ *
124
147
  * @since v0.6.0
125
148
  */
126
149
  @unsafe
@@ -138,6 +161,10 @@ provide let (*) = (x: Uint8, y: Uint8) => {
138
161
  * @param y: The second operand
139
162
  * @returns The quotient of its operands
140
163
  *
164
+ * @example
165
+ * use Uint8.{ (/) }
166
+ * assert 5us / 2us == 2us
167
+ *
141
168
  * @since v0.6.0
142
169
  */
143
170
  @unsafe
@@ -155,6 +182,8 @@ provide let (/) = (x: Uint8, y: Uint8) => {
155
182
  * @param y: The second operand
156
183
  * @returns The remainder of its operands
157
184
  *
185
+ * @example Uint8.rem(5us, 2us) == 1us
186
+ *
158
187
  * @since v0.6.0
159
188
  */
160
189
  @unsafe
@@ -172,6 +201,10 @@ provide let rem = (x: Uint8, y: Uint8) => {
172
201
  * @param amount: The number of bits to shift by
173
202
  * @returns The shifted value
174
203
  *
204
+ * @example
205
+ * use Uint8.{ (<<) }
206
+ * assert (5us << 1us) == 10us
207
+ *
175
208
  * @since v0.6.0
176
209
  */
177
210
  @unsafe
@@ -191,6 +224,10 @@ provide let (<<) = (value: Uint8, amount: Uint8) => {
191
224
  * @param amount: The amount to shift by
192
225
  * @returns The shifted value
193
226
  *
227
+ * @example
228
+ * use Uint8.{ (>>>) }
229
+ * assert (5us >>> 1us) == 2us
230
+ *
194
231
  * @since v0.6.0
195
232
  */
196
233
  @unsafe
@@ -210,6 +247,10 @@ provide let (>>>) = (value: Uint8, amount: Uint8) => {
210
247
  * @param y: The second value
211
248
  * @returns `true` if the first value is equal to the second value or `false` otherwise
212
249
  *
250
+ * @example
251
+ * use Uint8.{ (==) }
252
+ * assert 1us == 1us
253
+ *
213
254
  * @since v0.6.0
214
255
  */
215
256
  @unsafe
@@ -226,6 +267,10 @@ provide let (==) = (x: Uint8, y: Uint8) => {
226
267
  * @param y: The second value
227
268
  * @returns `true` if the first value is not equal to the second value or `false` otherwise
228
269
  *
270
+ * @example
271
+ * use Uint8.{ (!=) }
272
+ * assert 1us != 3us
273
+ *
229
274
  * @since v0.6.0
230
275
  */
231
276
  @unsafe
@@ -242,6 +287,10 @@ provide let (!=) = (x: Uint8, y: Uint8) => {
242
287
  * @param y: The second value
243
288
  * @returns `true` if the first value is less than the second value or `false` otherwise
244
289
  *
290
+ * @example
291
+ * use Uint8.{ (<) }
292
+ * assert 1us < 5us
293
+ *
245
294
  * @since v0.6.0
246
295
  */
247
296
  @unsafe
@@ -258,6 +307,10 @@ provide let (<) = (x: Uint8, y: Uint8) => {
258
307
  * @param y: The second value
259
308
  * @returns `true` if the first value is greater than the second value or `false` otherwise
260
309
  *
310
+ * @example
311
+ * use Uint8.{ (>) }
312
+ * assert 4us > 2us
313
+ *
261
314
  * @since v0.6.0
262
315
  */
263
316
  @unsafe
@@ -274,6 +327,13 @@ provide let (>) = (x: Uint8, y: Uint8) => {
274
327
  * @param y: The second value
275
328
  * @returns `true` if the first value is less than or equal to the second value or `false` otherwise
276
329
  *
330
+ * @example
331
+ * use Uint8.{ (<=) }
332
+ * assert 1us <= 2us
333
+ * @example
334
+ * use Uint8.{ (<=) }
335
+ * assert 1us <= 1us
336
+ *
277
337
  * @since v0.6.0
278
338
  */
279
339
  @unsafe
@@ -290,6 +350,13 @@ provide let (<=) = (x: Uint8, y: Uint8) => {
290
350
  * @param y: The second value
291
351
  * @returns `true` if the first value is greater than or equal to the second value or `false` otherwise
292
352
  *
353
+ * @example
354
+ * use Uint8.{ (>=) }
355
+ * assert 3us >= 2us
356
+ * @example
357
+ * use Uint8.{ (>=) }
358
+ * assert 1us >= 1us
359
+ *
293
360
  * @since v0.6.0
294
361
  */
295
362
  @unsafe
@@ -305,6 +372,8 @@ provide let (>=) = (x: Uint8, y: Uint8) => {
305
372
  * @param value: The given value
306
373
  * @returns Containing the inverted bits of the given value
307
374
  *
375
+ * @example Uint8.lnot(5us) == 250us
376
+ *
308
377
  * @since v0.6.0
309
378
  */
310
379
  @unsafe
@@ -320,6 +389,10 @@ provide let lnot = (value: Uint8) => {
320
389
  * @param y: The second operand
321
390
  * @returns Containing a `1` in each bit position for which the corresponding bits of both operands are `1`
322
391
  *
392
+ * @example
393
+ * use Uint8.{ (&) }
394
+ * assert (3us & 4us) == 0us
395
+ *
323
396
  * @since v0.6.0
324
397
  */
325
398
  @unsafe
@@ -338,6 +411,10 @@ provide let (&) = (x: Uint8, y: Uint8) => {
338
411
  * @param y: The second operand
339
412
  * @returns Containing a `1` in each bit position for which the corresponding bits of either or both operands are `1`
340
413
  *
414
+ * @example
415
+ * use Uint8.{ (|) }
416
+ * assert (3us | 4us) == 7us
417
+ *
341
418
  * @since v0.6.0
342
419
  */
343
420
  @unsafe
@@ -356,6 +433,10 @@ provide let (|) = (x: Uint8, y: Uint8) => {
356
433
  * @param y: The second operand
357
434
  * @returns Containing a `1` in each bit position for which the corresponding bits of either but not both operands are `1`
358
435
  *
436
+ * @example
437
+ * use Uint8.{ (^) }
438
+ * assert (3us ^ 5us) == 6us
439
+ *
359
440
  * @since v0.6.0
360
441
  */
361
442
  @unsafe
package/uint8.md CHANGED
@@ -13,6 +13,14 @@ No other changes yet.
13
13
  from "uint8" include Uint8
14
14
  ```
15
15
 
16
+ ```grain
17
+ 1us
18
+ ```
19
+
20
+ ```grain
21
+ 10us
22
+ ```
23
+
16
24
  ## Values
17
25
 
18
26
  Functions and constants included in the Uint8 module.
@@ -25,7 +33,7 @@ No other changes yet.
25
33
  </details>
26
34
 
27
35
  ```grain
28
- fromNumber : (number: Number) => Uint8
36
+ fromNumber: (number: Number) => Uint8
29
37
  ```
30
38
 
31
39
  Converts a Number to a Uint8.
@@ -50,7 +58,7 @@ No other changes yet.
50
58
  </details>
51
59
 
52
60
  ```grain
53
- toNumber : (value: Uint8) => Number
61
+ toNumber: (value: Uint8) => Number
54
62
  ```
55
63
 
56
64
  Converts a Uint8 to a Number.
@@ -75,7 +83,7 @@ No other changes yet.
75
83
  </details>
76
84
 
77
85
  ```grain
78
- fromInt8 : (number: Int8) => Uint8
86
+ fromInt8: (number: Int8) => Uint8
79
87
  ```
80
88
 
81
89
  Converts an Int8 to a Uint8.
@@ -92,6 +100,16 @@ Returns:
92
100
  |----|-----------|
93
101
  |`Uint8`|The Int8 represented as a Uint8|
94
102
 
103
+ Examples:
104
+
105
+ ```grain
106
+ Uint8.fromInt8(1s) == 1us
107
+ ```
108
+
109
+ ```grain
110
+ Uint8.fromInt8(-1s) == 255us
111
+ ```
112
+
95
113
  ### Uint8.**incr**
96
114
 
97
115
  <details disabled>
@@ -100,7 +118,7 @@ No other changes yet.
100
118
  </details>
101
119
 
102
120
  ```grain
103
- incr : (value: Uint8) => Uint8
121
+ incr: (value: Uint8) => Uint8
104
122
  ```
105
123
 
106
124
  Increments the value by one.
@@ -117,6 +135,12 @@ Returns:
117
135
  |----|-----------|
118
136
  |`Uint8`|The incremented value|
119
137
 
138
+ Examples:
139
+
140
+ ```grain
141
+ Uint8.incr(1us) == 2us
142
+ ```
143
+
120
144
  ### Uint8.**decr**
121
145
 
122
146
  <details disabled>
@@ -125,7 +149,7 @@ No other changes yet.
125
149
  </details>
126
150
 
127
151
  ```grain
128
- decr : (value: Uint8) => Uint8
152
+ decr: (value: Uint8) => Uint8
129
153
  ```
130
154
 
131
155
  Decrements the value by one.
@@ -142,6 +166,16 @@ Returns:
142
166
  |----|-----------|
143
167
  |`Uint8`|The decremented value|
144
168
 
169
+ Examples:
170
+
171
+ ```grain
172
+ Uint8.decr(1us) == 0us
173
+ ```
174
+
175
+ ```grain
176
+ Uint8.decr(0us) == 255us
177
+ ```
178
+
145
179
  ### Uint8.**(+)**
146
180
 
147
181
  <details disabled>
@@ -150,7 +184,7 @@ No other changes yet.
150
184
  </details>
151
185
 
152
186
  ```grain
153
- (+) : (x: Uint8, y: Uint8) => Uint8
187
+ (+): (x: Uint8, y: Uint8) => Uint8
154
188
  ```
155
189
 
156
190
  Computes the sum of its operands.
@@ -168,6 +202,13 @@ Returns:
168
202
  |----|-----------|
169
203
  |`Uint8`|The sum of the two operands|
170
204
 
205
+ Examples:
206
+
207
+ ```grain
208
+ use Uint8.{ (+) }
209
+ assert 1us + 1us == 2us
210
+ ```
211
+
171
212
  ### Uint8.**(-)**
172
213
 
173
214
  <details disabled>
@@ -176,7 +217,7 @@ No other changes yet.
176
217
  </details>
177
218
 
178
219
  ```grain
179
- (-) : (x: Uint8, y: Uint8) => Uint8
220
+ (-): (x: Uint8, y: Uint8) => Uint8
180
221
  ```
181
222
 
182
223
  Computes the difference of its operands.
@@ -194,6 +235,13 @@ Returns:
194
235
  |----|-----------|
195
236
  |`Uint8`|The difference of the two operands|
196
237
 
238
+ Examples:
239
+
240
+ ```grain
241
+ use Uint8.{ (-) }
242
+ assert 2us - 1us == 1us
243
+ ```
244
+
197
245
  ### Uint8.**(*)**
198
246
 
199
247
  <details disabled>
@@ -202,7 +250,7 @@ No other changes yet.
202
250
  </details>
203
251
 
204
252
  ```grain
205
- (*) : (x: Uint8, y: Uint8) => Uint8
253
+ (*): (x: Uint8, y: Uint8) => Uint8
206
254
  ```
207
255
 
208
256
  Computes the product of its operands.
@@ -220,6 +268,13 @@ Returns:
220
268
  |----|-----------|
221
269
  |`Uint8`|The product of the two operands|
222
270
 
271
+ Examples:
272
+
273
+ ```grain
274
+ use Uint8.{ (*) }
275
+ assert 2us * 2us == 4us
276
+ ```
277
+
223
278
  ### Uint8.**(/)**
224
279
 
225
280
  <details disabled>
@@ -228,7 +283,7 @@ No other changes yet.
228
283
  </details>
229
284
 
230
285
  ```grain
231
- (/) : (x: Uint8, y: Uint8) => Uint8
286
+ (/): (x: Uint8, y: Uint8) => Uint8
232
287
  ```
233
288
 
234
289
  Computes the quotient of its operands.
@@ -246,6 +301,13 @@ Returns:
246
301
  |----|-----------|
247
302
  |`Uint8`|The quotient of its operands|
248
303
 
304
+ Examples:
305
+
306
+ ```grain
307
+ use Uint8.{ (/) }
308
+ assert 5us / 2us == 2us
309
+ ```
310
+
249
311
  ### Uint8.**rem**
250
312
 
251
313
  <details disabled>
@@ -254,7 +316,7 @@ No other changes yet.
254
316
  </details>
255
317
 
256
318
  ```grain
257
- rem : (x: Uint8, y: Uint8) => Uint8
319
+ rem: (x: Uint8, y: Uint8) => Uint8
258
320
  ```
259
321
 
260
322
  Computes the remainder of the division of its operands.
@@ -272,6 +334,12 @@ Returns:
272
334
  |----|-----------|
273
335
  |`Uint8`|The remainder of its operands|
274
336
 
337
+ Examples:
338
+
339
+ ```grain
340
+ Uint8.rem(5us, 2us) == 1us
341
+ ```
342
+
275
343
  ### Uint8.**(<<)**
276
344
 
277
345
  <details disabled>
@@ -280,7 +348,7 @@ No other changes yet.
280
348
  </details>
281
349
 
282
350
  ```grain
283
- (<<) : (value: Uint8, amount: Uint8) => Uint8
351
+ (<<): (value: Uint8, amount: Uint8) => Uint8
284
352
  ```
285
353
 
286
354
  Shifts the bits of the value left by the given number of bits.
@@ -298,6 +366,13 @@ Returns:
298
366
  |----|-----------|
299
367
  |`Uint8`|The shifted value|
300
368
 
369
+ Examples:
370
+
371
+ ```grain
372
+ use Uint8.{ (<<) }
373
+ assert (5us << 1us) == 10us
374
+ ```
375
+
301
376
  ### Uint8.**(>>>)**
302
377
 
303
378
  <details disabled>
@@ -306,7 +381,7 @@ No other changes yet.
306
381
  </details>
307
382
 
308
383
  ```grain
309
- (>>>) : (value: Uint8, amount: Uint8) => Uint8
384
+ (>>>): (value: Uint8, amount: Uint8) => Uint8
310
385
  ```
311
386
 
312
387
  Shifts the bits of the value right by the given number of bits.
@@ -324,6 +399,13 @@ Returns:
324
399
  |----|-----------|
325
400
  |`Uint8`|The shifted value|
326
401
 
402
+ Examples:
403
+
404
+ ```grain
405
+ use Uint8.{ (>>>) }
406
+ assert (5us >>> 1us) == 2us
407
+ ```
408
+
327
409
  ### Uint8.**(==)**
328
410
 
329
411
  <details disabled>
@@ -332,7 +414,7 @@ No other changes yet.
332
414
  </details>
333
415
 
334
416
  ```grain
335
- (==) : (x: Uint8, y: Uint8) => Bool
417
+ (==): (x: Uint8, y: Uint8) => Bool
336
418
  ```
337
419
 
338
420
  Checks if the first value is equal to the second value.
@@ -350,6 +432,13 @@ Returns:
350
432
  |----|-----------|
351
433
  |`Bool`|`true` if the first value is equal to the second value or `false` otherwise|
352
434
 
435
+ Examples:
436
+
437
+ ```grain
438
+ use Uint8.{ (==) }
439
+ assert 1us == 1us
440
+ ```
441
+
353
442
  ### Uint8.**(!=)**
354
443
 
355
444
  <details disabled>
@@ -358,7 +447,7 @@ No other changes yet.
358
447
  </details>
359
448
 
360
449
  ```grain
361
- (!=) : (x: Uint8, y: Uint8) => Bool
450
+ (!=): (x: Uint8, y: Uint8) => Bool
362
451
  ```
363
452
 
364
453
  Checks if the first value is not equal to the second value.
@@ -376,6 +465,13 @@ Returns:
376
465
  |----|-----------|
377
466
  |`Bool`|`true` if the first value is not equal to the second value or `false` otherwise|
378
467
 
468
+ Examples:
469
+
470
+ ```grain
471
+ use Uint8.{ (!=) }
472
+ assert 1us != 3us
473
+ ```
474
+
379
475
  ### Uint8.**(<)**
380
476
 
381
477
  <details disabled>
@@ -384,7 +480,7 @@ No other changes yet.
384
480
  </details>
385
481
 
386
482
  ```grain
387
- (<) : (x: Uint8, y: Uint8) => Bool
483
+ (<): (x: Uint8, y: Uint8) => Bool
388
484
  ```
389
485
 
390
486
  Checks if the first value is less than the second value.
@@ -402,6 +498,13 @@ Returns:
402
498
  |----|-----------|
403
499
  |`Bool`|`true` if the first value is less than the second value or `false` otherwise|
404
500
 
501
+ Examples:
502
+
503
+ ```grain
504
+ use Uint8.{ (<) }
505
+ assert 1us < 5us
506
+ ```
507
+
405
508
  ### Uint8.**(>)**
406
509
 
407
510
  <details disabled>
@@ -410,7 +513,7 @@ No other changes yet.
410
513
  </details>
411
514
 
412
515
  ```grain
413
- (>) : (x: Uint8, y: Uint8) => Bool
516
+ (>): (x: Uint8, y: Uint8) => Bool
414
517
  ```
415
518
 
416
519
  Checks if the first value is greater than the second value.
@@ -428,6 +531,13 @@ Returns:
428
531
  |----|-----------|
429
532
  |`Bool`|`true` if the first value is greater than the second value or `false` otherwise|
430
533
 
534
+ Examples:
535
+
536
+ ```grain
537
+ use Uint8.{ (>) }
538
+ assert 4us > 2us
539
+ ```
540
+
431
541
  ### Uint8.**(<=)**
432
542
 
433
543
  <details disabled>
@@ -436,7 +546,7 @@ No other changes yet.
436
546
  </details>
437
547
 
438
548
  ```grain
439
- (<=) : (x: Uint8, y: Uint8) => Bool
549
+ (<=): (x: Uint8, y: Uint8) => Bool
440
550
  ```
441
551
 
442
552
  Checks if the first value is less than or equal to the second value.
@@ -454,6 +564,18 @@ Returns:
454
564
  |----|-----------|
455
565
  |`Bool`|`true` if the first value is less than or equal to the second value or `false` otherwise|
456
566
 
567
+ Examples:
568
+
569
+ ```grain
570
+ use Uint8.{ (<=) }
571
+ assert 1us <= 2us
572
+ ```
573
+
574
+ ```grain
575
+ use Uint8.{ (<=) }
576
+ assert 1us <= 1us
577
+ ```
578
+
457
579
  ### Uint8.**(>=)**
458
580
 
459
581
  <details disabled>
@@ -462,7 +584,7 @@ No other changes yet.
462
584
  </details>
463
585
 
464
586
  ```grain
465
- (>=) : (x: Uint8, y: Uint8) => Bool
587
+ (>=): (x: Uint8, y: Uint8) => Bool
466
588
  ```
467
589
 
468
590
  Checks if the first value is greater than or equal to the second value.
@@ -480,6 +602,18 @@ Returns:
480
602
  |----|-----------|
481
603
  |`Bool`|`true` if the first value is greater than or equal to the second value or `false` otherwise|
482
604
 
605
+ Examples:
606
+
607
+ ```grain
608
+ use Uint8.{ (>=) }
609
+ assert 3us >= 2us
610
+ ```
611
+
612
+ ```grain
613
+ use Uint8.{ (>=) }
614
+ assert 1us >= 1us
615
+ ```
616
+
483
617
  ### Uint8.**lnot**
484
618
 
485
619
  <details disabled>
@@ -488,7 +622,7 @@ No other changes yet.
488
622
  </details>
489
623
 
490
624
  ```grain
491
- lnot : (value: Uint8) => Uint8
625
+ lnot: (value: Uint8) => Uint8
492
626
  ```
493
627
 
494
628
  Computes the bitwise NOT of the given value.
@@ -505,6 +639,12 @@ Returns:
505
639
  |----|-----------|
506
640
  |`Uint8`|Containing the inverted bits of the given value|
507
641
 
642
+ Examples:
643
+
644
+ ```grain
645
+ Uint8.lnot(5us) == 250us
646
+ ```
647
+
508
648
  ### Uint8.**(&)**
509
649
 
510
650
  <details disabled>
@@ -513,7 +653,7 @@ No other changes yet.
513
653
  </details>
514
654
 
515
655
  ```grain
516
- (&) : (x: Uint8, y: Uint8) => Uint8
656
+ (&): (x: Uint8, y: Uint8) => Uint8
517
657
  ```
518
658
 
519
659
  Computes the bitwise AND (`&`) on the given operands.
@@ -531,6 +671,13 @@ Returns:
531
671
  |----|-----------|
532
672
  |`Uint8`|Containing a `1` in each bit position for which the corresponding bits of both operands are `1`|
533
673
 
674
+ Examples:
675
+
676
+ ```grain
677
+ use Uint8.{ (&) }
678
+ assert (3us & 4us) == 0us
679
+ ```
680
+
534
681
  ### Uint8.**(|)**
535
682
 
536
683
  <details disabled>
@@ -539,7 +686,7 @@ No other changes yet.
539
686
  </details>
540
687
 
541
688
  ```grain
542
- (|) : (x: Uint8, y: Uint8) => Uint8
689
+ (|): (x: Uint8, y: Uint8) => Uint8
543
690
  ```
544
691
 
545
692
  Computes the bitwise OR (`|`) on the given operands.
@@ -557,6 +704,13 @@ Returns:
557
704
  |----|-----------|
558
705
  |`Uint8`|Containing a `1` in each bit position for which the corresponding bits of either or both operands are `1`|
559
706
 
707
+ Examples:
708
+
709
+ ```grain
710
+ use Uint8.{ (|) }
711
+ assert (3us | 4us) == 7us
712
+ ```
713
+
560
714
  ### Uint8.**(^)**
561
715
 
562
716
  <details disabled>
@@ -565,7 +719,7 @@ No other changes yet.
565
719
  </details>
566
720
 
567
721
  ```grain
568
- (^) : (x: Uint8, y: Uint8) => Uint8
722
+ (^): (x: Uint8, y: Uint8) => Uint8
569
723
  ```
570
724
 
571
725
  Computes the bitwise XOR (`^`) on the given operands.
@@ -583,3 +737,10 @@ Returns:
583
737
  |----|-----------|
584
738
  |`Uint8`|Containing a `1` in each bit position for which the corresponding bits of either but not both operands are `1`|
585
739
 
740
+ Examples:
741
+
742
+ ```grain
743
+ use Uint8.{ (^) }
744
+ assert (3us ^ 5us) == 6us
745
+ ```
746
+