@grain/stdlib 0.6.6 → 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 (137) hide show
  1. package/CHANGELOG.md +57 -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 +328 -31
  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.md +22 -22
  124. package/uint32.gr +25 -4
  125. package/uint32.md +63 -28
  126. package/uint64.gr +25 -5
  127. package/uint64.md +63 -28
  128. package/uint8.md +22 -22
  129. package/uri.gr +57 -53
  130. package/uri.md +11 -12
  131. package/wasi/file.gr +67 -59
  132. package/wasi/file.md +39 -39
  133. package/wasi/process.md +5 -5
  134. package/wasi/random.md +3 -3
  135. package/wasi/time.md +4 -4
  136. package/runtime/utils/printing.gr +0 -60
  137. package/runtime/utils/printing.md +0 -26
package/char.md CHANGED
@@ -27,6 +27,27 @@ from "char" include Char
27
27
  '🌾'
28
28
  ```
29
29
 
30
+ ## Types
31
+
32
+ Type declarations included in the Char module.
33
+
34
+ ### Char.**Encoding**
35
+
36
+ <details disabled>
37
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
38
+ No other changes yet.
39
+ </details>
40
+
41
+ ```grain
42
+ enum Encoding {
43
+ UTF8,
44
+ UTF16,
45
+ UTF32,
46
+ }
47
+ ```
48
+
49
+ Byte encodings
50
+
30
51
  ## Values
31
52
 
32
53
  Functions and constants included in the Char module.
@@ -39,7 +60,7 @@ No other changes yet.
39
60
  </details>
40
61
 
41
62
  ```grain
42
- min : Number
63
+ min: Number
43
64
  ```
44
65
 
45
66
  The minimum valid Unicode scalar value.
@@ -52,7 +73,7 @@ No other changes yet.
52
73
  </details>
53
74
 
54
75
  ```grain
55
- max : Number
76
+ max: Number
56
77
  ```
57
78
 
58
79
  The maximum valid Unicode scalar value.
@@ -65,7 +86,7 @@ No other changes yet.
65
86
  </details>
66
87
 
67
88
  ```grain
68
- isValid : (charCode: Number) => Bool
89
+ isValid: (charCode: Number) => Bool
69
90
  ```
70
91
 
71
92
  Determines whether the given character code is a valid Unicode scalar value.
@@ -100,7 +121,7 @@ No other changes yet.
100
121
  </details>
101
122
 
102
123
  ```grain
103
- code : (char: Char) => Number
124
+ code: (char: Char) => Number
104
125
  ```
105
126
 
106
127
  Determines the Unicode scalar value for a character.
@@ -135,7 +156,7 @@ No other changes yet.
135
156
  </details>
136
157
 
137
158
  ```grain
138
- fromCode : (usv: Number) => Char
159
+ fromCode: (usv: Number) => Char
139
160
  ```
140
161
 
141
162
  Creates a character from the given Unicode scalar value.
@@ -176,7 +197,7 @@ No other changes yet.
176
197
  </details>
177
198
 
178
199
  ```grain
179
- succ : (char: Char) => Char
200
+ succ: (char: Char) => Char
180
201
  ```
181
202
 
182
203
  Returns the next valid character by Unicode scalar value.
@@ -217,7 +238,7 @@ No other changes yet.
217
238
  </details>
218
239
 
219
240
  ```grain
220
- pred : (char: Char) => Char
241
+ pred: (char: Char) => Char
221
242
  ```
222
243
 
223
244
  Returns the previous valid character by Unicode scalar value.
@@ -258,7 +279,7 @@ No other changes yet.
258
279
  </details>
259
280
 
260
281
  ```grain
261
- toString : (char: Char) => String
282
+ toString: (char: Char) => String
262
283
  ```
263
284
 
264
285
  Converts the given character to a string.
@@ -285,6 +306,46 @@ Char.toString('a') == "a"
285
306
  Char.toString('🌾') == "🌾"
286
307
  ```
287
308
 
309
+ ### Char.**encodedLength**
310
+
311
+ <details disabled>
312
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
313
+ No other changes yet.
314
+ </details>
315
+
316
+ ```grain
317
+ encodedLength: (encoding: Encoding, char: Char) => Number
318
+ ```
319
+
320
+ Returns the byte count of a character if encoded in the given encoding.
321
+
322
+ Parameters:
323
+
324
+ |param|type|description|
325
+ |-----|----|-----------|
326
+ |`encoding`|`Encoding`|The encoding to check|
327
+ |`char`|`Char`|The character|
328
+
329
+ Returns:
330
+
331
+ |type|description|
332
+ |----|-----------|
333
+ |`Number`|The byte count of the character in the given encoding|
334
+
335
+ Examples:
336
+
337
+ ```grain
338
+ Char.encodedLength(Char.UTF8, 'a') == 1
339
+ ```
340
+
341
+ ```grain
342
+ Char.encodedLength(Char.UTF8, '🌾') == 4
343
+ ```
344
+
345
+ ```grain
346
+ Char.encodedLength(Char.UTF16, '©') == 1
347
+ ```
348
+
288
349
  ### Char.**(<)**
289
350
 
290
351
  <details disabled>
@@ -293,7 +354,7 @@ No other changes yet.
293
354
  </details>
294
355
 
295
356
  ```grain
296
- (<) : (x: Char, y: Char) => Bool
357
+ (<): (x: Char, y: Char) => Bool
297
358
  ```
298
359
 
299
360
  Checks if the first character is less than the second character by Unicode scalar value.
@@ -331,7 +392,7 @@ No other changes yet.
331
392
  </details>
332
393
 
333
394
  ```grain
334
- (<=) : (x: Char, y: Char) => Bool
395
+ (<=): (x: Char, y: Char) => Bool
335
396
  ```
336
397
 
337
398
  Checks if the first character is less than or equal to the second character by Unicode scalar value.
@@ -374,7 +435,7 @@ No other changes yet.
374
435
  </details>
375
436
 
376
437
  ```grain
377
- (>) : (x: Char, y: Char) => Bool
438
+ (>): (x: Char, y: Char) => Bool
378
439
  ```
379
440
 
380
441
  Checks if the first character is greater than the second character by Unicode scalar value.
@@ -412,7 +473,7 @@ No other changes yet.
412
473
  </details>
413
474
 
414
475
  ```grain
415
- (>=) : (x: Char, y: Char) => Bool
476
+ (>=): (x: Char, y: Char) => Bool
416
477
  ```
417
478
 
418
479
  Checks if the first character is greater than or equal to the second character by Unicode scalar value.
@@ -447,15 +508,104 @@ use Char.{ (>=) }
447
508
  assert 'a' >= 'a'
448
509
  ```
449
510
 
450
- ### Char.**isAsciiDigit**
511
+ ## Char.Ascii
512
+
513
+ Utilities for working with ASCII characters.
451
514
 
452
515
  <details disabled>
453
- <summary tabindex="-1">Added in <code>0.6.0</code></summary>
516
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
454
517
  No other changes yet.
455
518
  </details>
456
519
 
457
520
  ```grain
458
- isAsciiDigit : (char: Char) => Bool
521
+ Char.Ascii.isAscii('1')
522
+ ```
523
+
524
+ ### Values
525
+
526
+ Functions and constants included in the Char.Ascii module.
527
+
528
+ #### Char.Ascii.**min**
529
+
530
+ <details disabled>
531
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
532
+ No other changes yet.
533
+ </details>
534
+
535
+ ```grain
536
+ min: Number
537
+ ```
538
+
539
+ The minimum valid ASCII character code.
540
+
541
+ #### Char.Ascii.**max**
542
+
543
+ <details disabled>
544
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
545
+ No other changes yet.
546
+ </details>
547
+
548
+ ```grain
549
+ max: Number
550
+ ```
551
+
552
+ The maximum valid ASCII character code.
553
+
554
+ #### Char.Ascii.**isValid**
555
+
556
+ <details disabled>
557
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
558
+ No other changes yet.
559
+ </details>
560
+
561
+ ```grain
562
+ isValid: (char: Char) => Bool
563
+ ```
564
+
565
+ Checks if the character is a valid ASCII character.
566
+
567
+ Parameters:
568
+
569
+ |param|type|description|
570
+ |-----|----|-----------|
571
+ |`char`|`Char`|The character to check|
572
+
573
+ Returns:
574
+
575
+ |type|description|
576
+ |----|-----------|
577
+ |`Bool`|`true` if the character is an ASCII character or `false` otherwise|
578
+
579
+ Examples:
580
+
581
+ ```grain
582
+ assert Char.Ascii.isValid('1')
583
+ ```
584
+
585
+ ```grain
586
+ assert Char.Ascii.isValid('a')
587
+ ```
588
+
589
+ ```grain
590
+ assert !Char.Ascii.isValid('🌾')
591
+ ```
592
+
593
+ #### Char.Ascii.**isDigit**
594
+
595
+ <details>
596
+ <summary>Added in <code>0.7.0</code></summary>
597
+ <table>
598
+ <thead>
599
+ <tr><th>version</th><th>changes</th></tr>
600
+ </thead>
601
+ <tbody>
602
+ <tr><td><code>0.6.0</code></td><td>Originally `Char.isAsciiDigit`</td></tr>
603
+ </tbody>
604
+ </table>
605
+ </details>
606
+
607
+ ```grain
608
+ isDigit: (char: Char) => Bool
459
609
  ```
460
610
 
461
611
  Checks if the character is an ASCII digit.
@@ -475,22 +625,29 @@ Returns:
475
625
  Examples:
476
626
 
477
627
  ```grain
478
- assert Char.isAsciiDigit('1')
628
+ assert Char.Ascii.isDigit('1')
479
629
  ```
480
630
 
481
631
  ```grain
482
- assert !Char.isAsciiDigit('a')
632
+ assert !Char.Ascii.isDigit('a')
483
633
  ```
484
634
 
485
- ### Char.**isAsciiAlpha**
635
+ #### Char.Ascii.**isAlpha**
486
636
 
487
- <details disabled>
488
- <summary tabindex="-1">Added in <code>0.6.0</code></summary>
489
- No other changes yet.
637
+ <details>
638
+ <summary>Added in <code>0.7.0</code></summary>
639
+ <table>
640
+ <thead>
641
+ <tr><th>version</th><th>changes</th></tr>
642
+ </thead>
643
+ <tbody>
644
+ <tr><td><code>0.6.0</code></td><td>Originally `Char.isAsciiAlpha`</td></tr>
645
+ </tbody>
646
+ </table>
490
647
  </details>
491
648
 
492
649
  ```grain
493
- isAsciiAlpha : (char: Char) => Bool
650
+ isAlpha: (char: Char) => Bool
494
651
  ```
495
652
 
496
653
  Checks if the character is an ASCII alphabetical character.
@@ -510,22 +667,185 @@ Returns:
510
667
  Examples:
511
668
 
512
669
  ```grain
513
- assert Char.isAsciiAlpha('a')
670
+ assert Char.Ascii.isAlpha('a')
514
671
  ```
515
672
 
516
673
  ```grain
517
- assert !Char.isAsciiAlpha('1')
674
+ assert !Char.Ascii.isAlpha('1')
518
675
  ```
519
676
 
520
- ### Char.**toAsciiLowercase**
677
+ #### Char.Ascii.**isControl**
521
678
 
522
679
  <details disabled>
523
- <summary tabindex="-1">Added in <code>0.6.0</code></summary>
680
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
681
+ No other changes yet.
682
+ </details>
683
+
684
+ ```grain
685
+ isControl: (char: Char) => Bool
686
+ ```
687
+
688
+ Checks if the character is an ASCII control character.
689
+
690
+ Parameters:
691
+
692
+ |param|type|description|
693
+ |-----|----|-----------|
694
+ |`char`|`Char`|The character to check|
695
+
696
+ Returns:
697
+
698
+ |type|description|
699
+ |----|-----------|
700
+ |`Bool`|`true` if the character is an ASCII control character or `false` otherwise|
701
+
702
+ Examples:
703
+
704
+ ```grain
705
+ assert Char.Ascii.isControl('\t')
706
+ ```
707
+
708
+ ```grain
709
+ assert Char.Ascii.isControl('\n')
710
+ ```
711
+
712
+ ```grain
713
+ assert !Char.Ascii.isControl('1')
714
+ ```
715
+
716
+ ```grain
717
+ assert !Char.Ascii.isControl('a')
718
+ ```
719
+
720
+ #### Char.Ascii.**isWhitespace**
721
+
722
+ <details disabled>
723
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
724
+ No other changes yet.
725
+ </details>
726
+
727
+ ```grain
728
+ isWhitespace: (char: Char) => Bool
729
+ ```
730
+
731
+ Checks if the character is an ASCII whitespace character.
732
+
733
+ Parameters:
734
+
735
+ |param|type|description|
736
+ |-----|----|-----------|
737
+ |`char`|`Char`|The character to check|
738
+
739
+ Returns:
740
+
741
+ |type|description|
742
+ |----|-----------|
743
+ |`Bool`|`true` if the character is an ASCII whitespace character or `false` otherwise|
744
+
745
+ Examples:
746
+
747
+ ```grain
748
+ assert Char.isWhitespace('\t')
749
+ ```
750
+
751
+ ```grain
752
+ assert Char.isWhitespace('\n')
753
+ ```
754
+
755
+ ```grain
756
+ assert !Char.isWhitespace('1')
757
+ ```
758
+
759
+ ```grain
760
+ assert !Char.isWhitespace('a')
761
+ ```
762
+
763
+ #### Char.Ascii.**isPunctuation**
764
+
765
+ <details disabled>
766
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
524
767
  No other changes yet.
525
768
  </details>
526
769
 
527
770
  ```grain
528
- toAsciiLowercase : (char: Char) => Char
771
+ isPunctuation: (char: Char) => Bool
772
+ ```
773
+
774
+ Checks if the character is an ASCII punctuation character.
775
+
776
+ Parameters:
777
+
778
+ |param|type|description|
779
+ |-----|----|-----------|
780
+ |`char`|`Char`|The character to check|
781
+
782
+ Returns:
783
+
784
+ |type|description|
785
+ |----|-----------|
786
+ |`Bool`|`true` if the character is an ASCII punctuation character or `false` otherwise|
787
+
788
+ Examples:
789
+
790
+ ```grain
791
+ assert Char.Ascii.isPunctuation('!')
792
+ ```
793
+
794
+ ```grain
795
+ assert !Char.Ascii.isPunctuation('1')
796
+ ```
797
+
798
+ #### Char.Ascii.**isGraphic**
799
+
800
+ <details disabled>
801
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
802
+ No other changes yet.
803
+ </details>
804
+
805
+ ```grain
806
+ isGraphic: (char: Char) => Bool
807
+ ```
808
+
809
+ Checks if the character is an ASCII graphic character.
810
+
811
+ Parameters:
812
+
813
+ |param|type|description|
814
+ |-----|----|-----------|
815
+ |`char`|`Char`|The character to check|
816
+
817
+ Returns:
818
+
819
+ |type|description|
820
+ |----|-----------|
821
+ |`Bool`|`true` if the character is an ASCII graphic character or `false` otherwise|
822
+
823
+ Examples:
824
+
825
+ ```grain
826
+ assert Char.Ascii.isGraphic('!')
827
+ ```
828
+
829
+ ```grain
830
+ assert !Char.Ascii.isGraphic('\t')
831
+ ```
832
+
833
+ #### Char.Ascii.**toLowercase**
834
+
835
+ <details>
836
+ <summary>Added in <code>0.7.0</code></summary>
837
+ <table>
838
+ <thead>
839
+ <tr><th>version</th><th>changes</th></tr>
840
+ </thead>
841
+ <tbody>
842
+ <tr><td><code>0.6.0</code></td><td>Originally `Char.toAsciiLowercase`</td></tr>
843
+ </tbody>
844
+ </table>
845
+ </details>
846
+
847
+ ```grain
848
+ toLowercase: (char: Char) => Char
529
849
  ```
530
850
 
531
851
  Converts the character to ASCII lowercase if it is an ASCII uppercase character.
@@ -545,18 +865,25 @@ Returns:
545
865
  Examples:
546
866
 
547
867
  ```grain
548
- assert Char.toAsciiLowercase('B') == 'b'
868
+ assert Char.Ascii.toLowercase('B') == 'b'
549
869
  ```
550
870
 
551
- ### Char.**toAsciiUppercase**
871
+ #### Char.Ascii.**toUppercase**
552
872
 
553
- <details disabled>
554
- <summary tabindex="-1">Added in <code>0.6.0</code></summary>
555
- No other changes yet.
873
+ <details>
874
+ <summary>Added in <code>0.7.0</code></summary>
875
+ <table>
876
+ <thead>
877
+ <tr><th>version</th><th>changes</th></tr>
878
+ </thead>
879
+ <tbody>
880
+ <tr><td><code>0.6.0</code></td><td>Originally `Char.toAsciiUppercase`</td></tr>
881
+ </tbody>
882
+ </table>
556
883
  </details>
557
884
 
558
885
  ```grain
559
- toAsciiUppercase : (char: Char) => Char
886
+ toUppercase: (char: Char) => Char
560
887
  ```
561
888
 
562
889
  Converts the character to ASCII uppercase if it is an ASCII lowercase character.
@@ -576,6 +903,6 @@ Returns:
576
903
  Examples:
577
904
 
578
905
  ```grain
579
- assert Char.toAsciiUppercase('b') == 'B'
906
+ assert Char.Ascii.toUppercase('b') == 'B'
580
907
  ```
581
908
 
package/exception.gr CHANGED
@@ -12,8 +12,6 @@
12
12
  */
13
13
  module Exception
14
14
 
15
- from "runtime/unsafe/wasmi32" include WasmI32
16
- from "runtime/unsafe/memory" include Memory
17
15
  from "runtime/exception" include Exception
18
16
 
19
17
  /**
@@ -39,13 +37,15 @@ from "runtime/exception" include Exception
39
37
  *
40
38
  * @since v0.3.0
41
39
  */
42
- @disableGC
43
- provide let rec registerPrinter = (printer: Exception => Option<String>) => {
44
- // This function _must_ be @disableGC because the printer list uses
45
- // unsafe types. Not really a memory leak as this list is never collected
40
+ provide let registerPrinter = Exception.registerPrinter
46
41
 
47
- // no need to increment refcount on f; we just don't decRef it at the end of the function
48
- Exception.printers = WasmI32.fromGrain((printer, Exception.printers))
49
- Memory.decRef(WasmI32.fromGrain(registerPrinter))
50
- void
51
- }
42
+ /**
43
+ * Gets the string representation of the given exception.
44
+ *
45
+ * @param e: The exception to stringify
46
+ *
47
+ * @returns The string representation of the exception
48
+ *
49
+ * @since v0.7.0
50
+ */
51
+ provide let toString = Exception.toString
package/exception.md CHANGED
@@ -35,7 +35,7 @@ No other changes yet.
35
35
  </details>
36
36
 
37
37
  ```grain
38
- registerPrinter : (printer: (Exception => Option<String>)) => Void
38
+ registerPrinter: (printer: (Exception => Option<String>)) => Void
39
39
  ```
40
40
 
41
41
  Registers an exception printer. When an exception is thrown, all registered
@@ -65,3 +65,28 @@ Exception.registerPrinter(e => {
65
65
  throw ExampleError(1) // Error found on line: 1
66
66
  ```
67
67
 
68
+ ### Exception.**toString**
69
+
70
+ <details disabled>
71
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
72
+ No other changes yet.
73
+ </details>
74
+
75
+ ```grain
76
+ toString: (e: Exception) => String
77
+ ```
78
+
79
+ Gets the string representation of the given exception.
80
+
81
+ Parameters:
82
+
83
+ |param|type|description|
84
+ |-----|----|-----------|
85
+ |`e`|`Exception`|The exception to stringify|
86
+
87
+ Returns:
88
+
89
+ |type|description|
90
+ |----|-----------|
91
+ |`String`|The string representation of the exception|
92
+