@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/path.gr CHANGED
@@ -722,6 +722,54 @@ provide let extension = (path: Path) => {
722
722
  }
723
723
  }
724
724
 
725
+ /**
726
+ * Removes the extension from a path, if there is no extension, returns the path as is.
727
+ *
728
+ * @param path: The path to modify
729
+ * @returns The path with the extension removed
730
+ *
731
+ * @example removeExtension(fromString("file.txt")) == fromString("file")
732
+ * @example removeExtension(fromString(".gitignore")) == fromString(".gitignore")
733
+ * @example removeExtension(fromString("./dir/file")) == fromString("dir/file")
734
+ * @example removeExtension(fromString("./dir/")) == fromString("dir/")
735
+ *
736
+ * @since v7.0.0
737
+ */
738
+ provide let removeExtension = (path: Path) => {
739
+ match (pathInfo(path)) {
740
+ (base, File, [name, ...rest]) as pathInfo => {
741
+ let (name, _) = stemExtHelper(pathInfo)
742
+ toPath((base, File, [name, ...rest]))
743
+ },
744
+ _ => path,
745
+ }
746
+ }
747
+
748
+ /**
749
+ * Updates the file extension of the given path.
750
+ *
751
+ * @param path: The path to modify
752
+ * @param extension: The new extension
753
+ * @returns The modified path
754
+ *
755
+ * @example updateExtension(fromString("file.txt"), "ext") == fromString("file.ext")
756
+ * @example updateExtension(fromString("file.txt"), "") == fromString("file.")
757
+ * @example updateExtension(fromString(".gitignore"), "ext") == fromString(".gitignore.ext")
758
+ * @example updateExtension(fromString("./dir/file"), "ext") == fromString("dir/file.ext")
759
+ * @example updateExtension(fromString("./dir/"), "ext") == fromString("dir/")
760
+ *
761
+ * @since v7.0.0
762
+ */
763
+ provide let updateExtension = (path: Path, extension: String) => {
764
+ match (pathInfo(path)) {
765
+ (base, File, [name, ...rest]) as pathInfo => {
766
+ let (name, _) = stemExtHelper(pathInfo)
767
+ toPath((base, File, [name ++ "." ++ extension, ...rest]))
768
+ },
769
+ _ => path,
770
+ }
771
+ }
772
+
725
773
  // should only be used on absolute paths
726
774
  let rootHelper = (path: PathInfo) => match (path) {
727
775
  (Abs(root), _, _) => root,
package/path.md CHANGED
@@ -184,7 +184,7 @@ Functions and constants included in the Path module.
184
184
  </details>
185
185
 
186
186
  ```grain
187
- fromString : (pathStr: String, ?platform: Platform) => Path
187
+ fromString: (pathStr: String, ?platform: Platform) => Path
188
188
  ```
189
189
 
190
190
  Parses a path string into a `Path` using the path separators appropriate to
@@ -238,7 +238,7 @@ fromString("C:\\file.txt", Windows) // a relative Path referencing the file C:\f
238
238
  </details>
239
239
 
240
240
  ```grain
241
- toString : (path: Path, ?platform: Platform) => String
241
+ toString: (path: Path, ?platform: Platform) => String
242
242
  ```
243
243
 
244
244
  Converts the given `Path` into a string, using the canonical path separator
@@ -280,7 +280,7 @@ No other changes yet.
280
280
  </details>
281
281
 
282
282
  ```grain
283
- isDirectory : (path: Path) => Bool
283
+ isDirectory: (path: Path) => Bool
284
284
  ```
285
285
 
286
286
  Determines whether the path is a directory path.
@@ -310,7 +310,7 @@ isDirectory(fromString("/bin/")) == true
310
310
  ### Path.**isAbsolute**
311
311
 
312
312
  ```grain
313
- isAbsolute : (path: Path) => Bool
313
+ isAbsolute: (path: Path) => Bool
314
314
  ```
315
315
 
316
316
  Determines whether the path is an absolute path.
@@ -345,7 +345,7 @@ No other changes yet.
345
345
  </details>
346
346
 
347
347
  ```grain
348
- append : (path: Path, toAppend: Path) => Result<Path, AppendError>
348
+ append: (path: Path, toAppend: Path) => Result<Path, AppendError>
349
349
  ```
350
350
 
351
351
  Creates a new path by appending a relative path segment to a directory path.
@@ -385,7 +385,7 @@ No other changes yet.
385
385
  </details>
386
386
 
387
387
  ```grain
388
- relativeTo : (source: Path, dest: Path) => Result<Path, RelativizationError>
388
+ relativeTo: (source: Path, dest: Path) => Result<Path, RelativizationError>
389
389
  ```
390
390
 
391
391
  Attempts to construct a new relative path which will lead to the destination
@@ -444,7 +444,7 @@ No other changes yet.
444
444
  </details>
445
445
 
446
446
  ```grain
447
- ancestry :
447
+ ancestry:
448
448
  (base: Path, path: Path) => Result<AncestryStatus, IncompatibilityError>
449
449
  ```
450
450
 
@@ -489,7 +489,7 @@ No other changes yet.
489
489
  </details>
490
490
 
491
491
  ```grain
492
- parent : (path: Path) => Path
492
+ parent: (path: Path) => Path
493
493
  ```
494
494
 
495
495
  Retrieves the path corresponding to the parent directory of the given path.
@@ -524,7 +524,7 @@ No other changes yet.
524
524
  </details>
525
525
 
526
526
  ```grain
527
- basename : (path: Path) => Option<String>
527
+ basename: (path: Path) => Option<String>
528
528
  ```
529
529
 
530
530
  Retrieves the basename (named final segment) of a path.
@@ -559,7 +559,7 @@ No other changes yet.
559
559
  </details>
560
560
 
561
561
  ```grain
562
- stem : (path: Path) => Result<String, PathOperationError>
562
+ stem: (path: Path) => Result<String, PathOperationError>
563
563
  ```
564
564
 
565
565
  Retrieves the basename of a file path without the extension.
@@ -602,7 +602,7 @@ No other changes yet.
602
602
  </details>
603
603
 
604
604
  ```grain
605
- extension : (path: Path) => Result<String, PathOperationError>
605
+ extension: (path: Path) => Result<String, PathOperationError>
606
606
  ```
607
607
 
608
608
  Retrieves the extension on the basename of a file path.
@@ -637,6 +637,97 @@ extension(fromString(".a.tar.gz")) == Ok(".tar.gz")
637
637
  extension(fromString("/dir/")) == Err(IncompatiblePathType) // can only take extension of a file path
638
638
  ```
639
639
 
640
+ ### Path.**removeExtension**
641
+
642
+ <details disabled>
643
+ <summary tabindex="-1">Added in <code>next</code></summary>
644
+ No other changes yet.
645
+ </details>
646
+
647
+ ```grain
648
+ removeExtension: (path: Path) => Path
649
+ ```
650
+
651
+ Removes the extension from a path, if there is no extension, returns the path as is.
652
+
653
+ Parameters:
654
+
655
+ |param|type|description|
656
+ |-----|----|-----------|
657
+ |`path`|`Path`|The path to modify|
658
+
659
+ Returns:
660
+
661
+ |type|description|
662
+ |----|-----------|
663
+ |`Path`|The path with the extension removed|
664
+
665
+ Examples:
666
+
667
+ ```grain
668
+ removeExtension(fromString("file.txt")) == fromString("file")
669
+ ```
670
+
671
+ ```grain
672
+ removeExtension(fromString(".gitignore")) == fromString(".gitignore")
673
+ ```
674
+
675
+ ```grain
676
+ removeExtension(fromString("./dir/file")) == fromString("dir/file")
677
+ ```
678
+
679
+ ```grain
680
+ removeExtension(fromString("./dir/")) == fromString("dir/")
681
+ ```
682
+
683
+ ### Path.**updateExtension**
684
+
685
+ <details disabled>
686
+ <summary tabindex="-1">Added in <code>next</code></summary>
687
+ No other changes yet.
688
+ </details>
689
+
690
+ ```grain
691
+ updateExtension: (path: Path, extension: String) => Path
692
+ ```
693
+
694
+ Updates the file extension of the given path.
695
+
696
+ Parameters:
697
+
698
+ |param|type|description|
699
+ |-----|----|-----------|
700
+ |`path`|`Path`|The path to modify|
701
+ |`extension`|`String`|The new extension|
702
+
703
+ Returns:
704
+
705
+ |type|description|
706
+ |----|-----------|
707
+ |`Path`|The modified path|
708
+
709
+ Examples:
710
+
711
+ ```grain
712
+ updateExtension(fromString("file.txt"), "ext") == fromString("file.ext")
713
+ ```
714
+
715
+ ```grain
716
+ updateExtension(fromString("file.txt"), "") == fromString("file.")
717
+ ```
718
+
719
+ ```grain
720
+ updateExtension(fromString(".gitignore"), "ext") == fromString(".gitignore.ext")
721
+ ```
722
+
723
+ ```grain
724
+ updateExtension(fromString("./dir/file"), "ext") == fromString("dir/file.ext")
725
+ ```
726
+
727
+ ```grain
728
+ updateExtension(fromString("./dir/"), "ext") == fromString("dir/")
729
+ ```
730
+
640
731
  ### Path.**root**
641
732
 
642
733
  <details disabled>
@@ -645,7 +736,7 @@ No other changes yet.
645
736
  </details>
646
737
 
647
738
  ```grain
648
- root : (path: Path) => Result<AbsoluteRoot, PathOperationError>
739
+ root: (path: Path) => Result<AbsoluteRoot, PathOperationError>
649
740
  ```
650
741
 
651
742
  Retrieves the root of the absolute path.
package/pervasives.gr CHANGED
@@ -236,7 +236,7 @@ provide primitive unbox = "@unbox"
236
236
  primitive elideTypeInfo = "@meta.elide_type_info"
237
237
  @unsafe
238
238
  let setupExceptions = () => {
239
- Exception.dangerouslyRegisterPrinter(e => {
239
+ Exception.registerPrinter(e => {
240
240
  match (e) {
241
241
  Failure(msg) => Some("Failure: " ++ msg),
242
242
  InvalidArgument(msg) => Some("Invalid argument: " ++ msg),
@@ -247,7 +247,7 @@ let setupExceptions = () => {
247
247
  // If type information is elided, remove dependency on toString as
248
248
  // it will have no effect on exceptions
249
249
  if (!elideTypeInfo) {
250
- Exception.dangerouslyRegisterBasePrinter(e => Some(toString(e)))
250
+ Exception.registerBasePrinter(e => toString(e))
251
251
  }
252
252
  }
253
253
 
package/pervasives.md CHANGED
@@ -25,7 +25,7 @@ No other changes yet.
25
25
  </details>
26
26
 
27
27
  ```grain
28
- (!) : (bool: Bool) => Bool
28
+ (!): (bool: Bool) => Bool
29
29
  ```
30
30
 
31
31
  Computes the logical NOT (`!`) of the given operand.
@@ -61,7 +61,7 @@ No other changes yet.
61
61
  </details>
62
62
 
63
63
  ```grain
64
- (&&) : (left: Bool, right: Bool) => Bool
64
+ (&&): (left: Bool, right: Bool) => Bool
65
65
  ```
66
66
 
67
67
  Computes the logical AND (`&&`) of the given operands.
@@ -90,7 +90,7 @@ No other changes yet.
90
90
  </details>
91
91
 
92
92
  ```grain
93
- (||) : (left: Bool, right: Bool) => Bool
93
+ (||): (left: Bool, right: Bool) => Bool
94
94
  ```
95
95
 
96
96
  Computes the logical OR `||` of the given operands.
@@ -119,7 +119,7 @@ No other changes yet.
119
119
  </details>
120
120
 
121
121
  ```grain
122
- (==) : (value1: a, value2: a) => Bool
122
+ (==): (value1: a, value2: a) => Bool
123
123
  ```
124
124
 
125
125
  Check that two values are equal. This checks for structural equality,
@@ -146,7 +146,7 @@ No other changes yet.
146
146
  </details>
147
147
 
148
148
  ```grain
149
- (!=) : (value1: a, value2: a) => Bool
149
+ (!=): (value1: a, value2: a) => Bool
150
150
  ```
151
151
 
152
152
  Check that two values are **not** equal. This checks for structural equality,
@@ -173,7 +173,7 @@ No other changes yet.
173
173
  </details>
174
174
 
175
175
  ```grain
176
- is : (left: a, right: a) => Bool
176
+ is: (left: a, right: a) => Bool
177
177
  ```
178
178
 
179
179
  Checks that two values are physically equal.
@@ -200,7 +200,7 @@ No other changes yet.
200
200
  </details>
201
201
 
202
202
  ```grain
203
- isnt : (value1: a, value2: a) => Bool
203
+ isnt: (value1: a, value2: a) => Bool
204
204
  ```
205
205
 
206
206
  Checks that two values are **not** physically equal.
@@ -227,7 +227,7 @@ No other changes yet.
227
227
  </details>
228
228
 
229
229
  ```grain
230
- (<) : (num1: Number, num2: Number) => Bool
230
+ (<): (num1: Number, num2: Number) => Bool
231
231
  ```
232
232
 
233
233
  Checks if the first operand is less than the second operand.
@@ -253,7 +253,7 @@ No other changes yet.
253
253
  </details>
254
254
 
255
255
  ```grain
256
- (>) : (num1: Number, num2: Number) => Bool
256
+ (>): (num1: Number, num2: Number) => Bool
257
257
  ```
258
258
 
259
259
  Checks if the first operand is greater than the second operand.
@@ -279,7 +279,7 @@ No other changes yet.
279
279
  </details>
280
280
 
281
281
  ```grain
282
- (<=) : (num1: Number, num2: Number) => Bool
282
+ (<=): (num1: Number, num2: Number) => Bool
283
283
  ```
284
284
 
285
285
  Checks if the first operand is less than or equal to the second operand.
@@ -305,7 +305,7 @@ No other changes yet.
305
305
  </details>
306
306
 
307
307
  ```grain
308
- (>=) : (num1: Number, num2: Number) => Bool
308
+ (>=): (num1: Number, num2: Number) => Bool
309
309
  ```
310
310
 
311
311
  Checks if the first operand is greater than or equal to the second operand.
@@ -331,7 +331,7 @@ No other changes yet.
331
331
  </details>
332
332
 
333
333
  ```grain
334
- compare : (num1: a, num2: a) => Number
334
+ compare: (num1: a, num2: a) => Number
335
335
  ```
336
336
 
337
337
  Compares the first argument to the second argument and produces an integer result.
@@ -359,7 +359,7 @@ No other changes yet.
359
359
  </details>
360
360
 
361
361
  ```grain
362
- (+) : (num1: Number, num2: Number) => Number
362
+ (+): (num1: Number, num2: Number) => Number
363
363
  ```
364
364
 
365
365
  Computes the sum of its operands.
@@ -385,7 +385,7 @@ No other changes yet.
385
385
  </details>
386
386
 
387
387
  ```grain
388
- (-) : (num1: Number, num2: Number) => Number
388
+ (-): (num1: Number, num2: Number) => Number
389
389
  ```
390
390
 
391
391
  Computes the difference of its operands.
@@ -411,7 +411,7 @@ No other changes yet.
411
411
  </details>
412
412
 
413
413
  ```grain
414
- (*) : (num1: Number, num2: Number) => Number
414
+ (*): (num1: Number, num2: Number) => Number
415
415
  ```
416
416
 
417
417
  Computes the product of its operands.
@@ -437,7 +437,7 @@ No other changes yet.
437
437
  </details>
438
438
 
439
439
  ```grain
440
- (/) : (num1: Number, num2: Number) => Number
440
+ (/): (num1: Number, num2: Number) => Number
441
441
  ```
442
442
 
443
443
  Computes the quotient of its operands.
@@ -463,7 +463,7 @@ No other changes yet.
463
463
  </details>
464
464
 
465
465
  ```grain
466
- (%) : (num1: Number, num2: Number) => Number
466
+ (%): (num1: Number, num2: Number) => Number
467
467
  ```
468
468
 
469
469
  Computes the remainder of the division of the first operand by the second.
@@ -497,7 +497,7 @@ Returns:
497
497
  </details>
498
498
 
499
499
  ```grain
500
- (**) : (base: Number, power: Number) => Number
500
+ (**): (base: Number, power: Number) => Number
501
501
  ```
502
502
 
503
503
  Computes the exponentiation of the given base and power.
@@ -523,7 +523,7 @@ No other changes yet.
523
523
  </details>
524
524
 
525
525
  ```grain
526
- incr : (value: Number) => Number
526
+ incr: (value: Number) => Number
527
527
  ```
528
528
 
529
529
  Increments the value by one.
@@ -548,7 +548,7 @@ No other changes yet.
548
548
  </details>
549
549
 
550
550
  ```grain
551
- decr : (value: Number) => Number
551
+ decr: (value: Number) => Number
552
552
  ```
553
553
 
554
554
  Decrements the value by one.
@@ -573,7 +573,7 @@ No other changes yet.
573
573
  </details>
574
574
 
575
575
  ```grain
576
- (++) : (str1: String, str2: String) => String
576
+ (++): (str1: String, str2: String) => String
577
577
  ```
578
578
 
579
579
  Concatenate two strings.
@@ -605,7 +605,7 @@ No other changes yet.
605
605
  </details>
606
606
 
607
607
  ```grain
608
- lnot : (value: Number) => Number
608
+ lnot: (value: Number) => Number
609
609
  ```
610
610
 
611
611
  Computes the bitwise NOT of the operand.
@@ -638,7 +638,7 @@ Returns:
638
638
  </details>
639
639
 
640
640
  ```grain
641
- (&) : (value1: Number, value2: Number) => Number
641
+ (&): (value1: Number, value2: Number) => Number
642
642
  ```
643
643
 
644
644
  Computes the bitwise AND (`&`) on the given operands.
@@ -672,7 +672,7 @@ Returns:
672
672
  </details>
673
673
 
674
674
  ```grain
675
- (|) : (value1: Number, value2: Number) => Number
675
+ (|): (value1: Number, value2: Number) => Number
676
676
  ```
677
677
 
678
678
  Computes the bitwise OR (`|`) on the given operands.
@@ -707,7 +707,7 @@ Returns:
707
707
  </details>
708
708
 
709
709
  ```grain
710
- (^) : (value1: Number, value2: Number) => Number
710
+ (^): (value1: Number, value2: Number) => Number
711
711
  ```
712
712
 
713
713
  Computes the bitwise XOR (`^`) on the given operands.
@@ -741,7 +741,7 @@ Returns:
741
741
  </details>
742
742
 
743
743
  ```grain
744
- (<<) : (value: Number, amount: Number) => Number
744
+ (<<): (value: Number, amount: Number) => Number
745
745
  ```
746
746
 
747
747
  Shifts the bits of the value left by the given number of bits.
@@ -775,7 +775,7 @@ Returns:
775
775
  </details>
776
776
 
777
777
  ```grain
778
- (>>>) : (value: Number, amount: Number) => Number
778
+ (>>>): (value: Number, amount: Number) => Number
779
779
  ```
780
780
 
781
781
  Shifts the bits of the value right by the given number of bits, preserving the sign bit.
@@ -809,7 +809,7 @@ Returns:
809
809
  </details>
810
810
 
811
811
  ```grain
812
- (>>) : (value: Number, amount: Number) => Number
812
+ (>>): (value: Number, amount: Number) => Number
813
813
  ```
814
814
 
815
815
  Shifts the bits of the value right by the given number of bits.
@@ -835,7 +835,7 @@ No other changes yet.
835
835
  </details>
836
836
 
837
837
  ```grain
838
- toString : (value: a) => String
838
+ toString: (value: a) => String
839
839
  ```
840
840
 
841
841
  Converts the given operand to a string.
@@ -868,7 +868,7 @@ Returns:
868
868
  </details>
869
869
 
870
870
  ```grain
871
- print : (value: a, ?suffix: String) => Void
871
+ print: (value: a, ?suffix: String) => Void
872
872
  ```
873
873
 
874
874
  Prints the given operand to the console. Works for any type. Internally, calls `toString`
@@ -890,7 +890,7 @@ No other changes yet.
890
890
  </details>
891
891
 
892
892
  ```grain
893
- ignore : (value: a) => Void
893
+ ignore: (value: a) => Void
894
894
  ```
895
895
 
896
896
  Accepts any value and always returns `void`.
@@ -909,7 +909,7 @@ No other changes yet.
909
909
  </details>
910
910
 
911
911
  ```grain
912
- assert : (condition: Bool) => Void
912
+ assert: (condition: Bool) => Void
913
913
  ```
914
914
 
915
915
  Assert that the given Boolean condition is `true`.
@@ -944,7 +944,7 @@ No other changes yet.
944
944
  </details>
945
945
 
946
946
  ```grain
947
- throw : (exn: Exception) => a
947
+ throw: (exn: Exception) => a
948
948
  ```
949
949
 
950
950
  Throw an exception. Currently, exceptions cannot be caught and will crash your program.
@@ -964,7 +964,7 @@ Returns:
964
964
  ### Pervasives.**fail**
965
965
 
966
966
  ```grain
967
- fail : (message: String) => a
967
+ fail: (message: String) => a
968
968
  ```
969
969
 
970
970
  Unconditionally throw a `Failure` exception with a message.
@@ -990,7 +990,7 @@ No other changes yet.
990
990
  </details>
991
991
 
992
992
  ```grain
993
- identity : (value: a) => a
993
+ identity: (value: a) => a
994
994
  ```
995
995
 
996
996
  Provides the operand untouched.
@@ -1015,7 +1015,7 @@ No other changes yet.
1015
1015
  </details>
1016
1016
 
1017
1017
  ```grain
1018
- box : (value: a) => Box<a>
1018
+ box: (value: a) => Box<a>
1019
1019
  ```
1020
1020
 
1021
1021
  Creates a box containing the given initial value.
@@ -1042,7 +1042,7 @@ No other changes yet.
1042
1042
  </details>
1043
1043
 
1044
1044
  ```grain
1045
- unbox : (value: Box<a>) => a
1045
+ unbox: (value: Box<a>) => a
1046
1046
  ```
1047
1047
 
1048
1048
  Retrieves the current value from a box.
package/priorityqueue.gr CHANGED
@@ -31,9 +31,9 @@ let swap = (i1, i2, array) => {
31
31
 
32
32
  let get = (array, i) =>
33
33
  Option.expect(
34
- "Impossible: " ++
35
- toString(i) ++
36
- " in PriorityQueue's inner storage array is None",
34
+ "Impossible: "
35
+ ++ toString(i)
36
+ ++ " in PriorityQueue's inner storage array is None",
37
37
  array[i]
38
38
  )
39
39
 
@@ -47,8 +47,8 @@ let rec siftDown = (i, pq) => {
47
47
  swapWithI = leftI
48
48
  }
49
49
  if (
50
- rightI < pq.size &&
51
- pq.comp(get(pq.array, rightI), get(pq.array, swapWithI)) < 0
50
+ rightI < pq.size
51
+ && pq.comp(get(pq.array, rightI), get(pq.array, swapWithI)) < 0
52
52
  ) {
53
53
  swapWithI = rightI
54
54
  }
@@ -340,8 +340,8 @@ provide module Immutable {
340
340
  children: [newNode, node2, ...node1.children],
341
341
  }
342
342
  } else if (
343
- comp(node2.val, newNode.val) <= 0 &&
344
- comp(node2.val, node1.val) <= 0
343
+ comp(node2.val, newNode.val) <= 0
344
+ && comp(node2.val, node1.val) <= 0
345
345
  ) {
346
346
  {
347
347
  val: node2.val,