@grain/stdlib 0.5.13 → 0.6.1

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 +201 -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 +62 -40
  21. package/hash.md +27 -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 +2071 -0
  31. package/json.md +646 -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 +193 -174
  92. package/runtime/numberUtils.md +29 -9
  93. package/runtime/numbers.gr +1695 -1021
  94. package/runtime/numbers.md +1098 -134
  95. package/runtime/string.gr +543 -245
  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/CHANGELOG.md CHANGED
@@ -1,5 +1,206 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.1](https://github.com/grain-lang/grain/compare/stdlib-v0.6.0...stdlib-v0.6.1) (2024-03-29)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **stdlib:** Avoid WASI random_get in Hash stdlib during module startup ([#2078](https://github.com/grain-lang/grain/issues/2078)) ([7eadfb0](https://github.com/grain-lang/grain/commit/7eadfb097e64b043c860d27d21d36d4bfea1ea96))
9
+ * **stdlib:** Implement `print` using a single element io vec ([#2066](https://github.com/grain-lang/grain/issues/2066)) ([9eeb0f2](https://github.com/grain-lang/grain/commit/9eeb0f2edb14facc619c1ede27a5700a27e64e3f))
10
+
11
+ ## [0.6.0](https://github.com/grain-lang/grain/compare/stdlib-v0.5.13...stdlib-v0.6.0) (2024-03-04)
12
+
13
+
14
+ ### ⚠ BREAKING CHANGES
15
+
16
+ * **stdlib:** Replace `parseInt` error strings with structured error enum ([#1755](https://github.com/grain-lang/grain/issues/1755))
17
+ * **stdlib:** Move stdlib `sys` modules to `wasi` ([#2056](https://github.com/grain-lang/grain/issues/2056))
18
+ * **compiler:** Remove arbitrary per-file compiler flags, add acceptable options as module attributes ([#1804](https://github.com/grain-lang/grain/issues/1804))
19
+ * **compiler:** Require extension when including relative file paths ([#1842](https://github.com/grain-lang/grain/issues/1842))
20
+ * **compiler:** Update include syntax ([#2043](https://github.com/grain-lang/grain/issues/2043))
21
+ * **stdlib:** Remove `sin`, `cos`, `tan`, `gamma`, `factorial` from `Number` module ([#2046](https://github.com/grain-lang/grain/issues/2046))
22
+ * **compiler:** Update use syntax ([#2041](https://github.com/grain-lang/grain/issues/2041))
23
+ * **grainfmt:** Implement new formatter ([#1976](https://github.com/grain-lang/grain/issues/1976))
24
+ * **stdlib:** Use default arguments in more of stdlib ([#1772](https://github.com/grain-lang/grain/issues/1772))
25
+ * **stdlib:** Add `print` suffix default argument ([#1768](https://github.com/grain-lang/grain/issues/1768))
26
+ * **graindoc:** Improve docgen for labeled & default arguments ([#1776](https://github.com/grain-lang/grain/issues/1776))
27
+ * **stdlib:** Replace `Float64` arithmatic/comparison functions with operators ([#1957](https://github.com/grain-lang/grain/issues/1957))
28
+ * **stdlib:** Replace `Float32` arithmatic/comparison functions with operators ([#1954](https://github.com/grain-lang/grain/issues/1954))
29
+ * **stdlib:** Replace `Int64` arithmatic functions with operators ([#1935](https://github.com/grain-lang/grain/issues/1935))
30
+ * **stdlib:** Replace `Int32` arithmatic functions with operators ([#1936](https://github.com/grain-lang/grain/issues/1936))
31
+ * **stdlib:** Switch to using records for `getInternalStats` ([#1898](https://github.com/grain-lang/grain/issues/1898))
32
+ * **cli:** Allow specifying WASI environment variables and CLI args ([#1840](https://github.com/grain-lang/grain/issues/1840))
33
+ * **stdlib:** Reorder parameters to `List.insert` ([#1857](https://github.com/grain-lang/grain/issues/1857))
34
+ * **stdlib:** Handle printing of reference cycles ([#1844](https://github.com/grain-lang/grain/issues/1844))
35
+ * **compiler:** Change `->` to `=>` in type signatures ([#1855](https://github.com/grain-lang/grain/issues/1855))
36
+ * **compiler:** Make types nonrecursive by default ([#1826](https://github.com/grain-lang/grain/issues/1826))
37
+ * **compiler:** Remove static runtime pointers ([#1806](https://github.com/grain-lang/grain/issues/1806))
38
+ * **compiler:** Changed comma to `and` in mutually rec types
39
+ * **compiler:** Changed comma to `and` in recursive types and bindings ([#1827](https://github.com/grain-lang/grain/issues/1827))
40
+ * Remove js-runner ([#1585](https://github.com/grain-lang/grain/issues/1585))
41
+ * **stdlib:** Replace `Result`/`Option` `and`/`or` functions with operators ([#1821](https://github.com/grain-lang/grain/issues/1821))
42
+ * **compiler:** Reduce size of runtime heap ([#1807](https://github.com/grain-lang/grain/issues/1807))
43
+ * Require node version >=18.15 for WASI support ([#1612](https://github.com/grain-lang/grain/issues/1612))
44
+ * **stdlib:** Ensure `Array.fillRange` works with negative indexing & throws IndexOutOfBound ([#1761](https://github.com/grain-lang/grain/issues/1761))
45
+ * **stdlib:** Remove extra space when converting Bytes to String ([#1800](https://github.com/grain-lang/grain/issues/1800))
46
+ * **stdlib:** Convert unsafe `Wasm` functions to operators ([#1734](https://github.com/grain-lang/grain/issues/1734))
47
+ * **stdlib:** Use Array length as default end in `Array.slice` function ([#1762](https://github.com/grain-lang/grain/issues/1762))
48
+ * **stdlib:** Use String length as default end in `String.slice` function ([#1748](https://github.com/grain-lang/grain/issues/1748))
49
+ * Rework preopened directories ([#1656](https://github.com/grain-lang/grain/issues/1656))
50
+ * **stdlib:** Group mutable/immutable data structures ([#1652](https://github.com/grain-lang/grain/issues/1652))
51
+ * **compiler:** Optimize type metadata loading ([#1741](https://github.com/grain-lang/grain/issues/1741))
52
+ * **compiler:** Labeled and default arguments ([#1623](https://github.com/grain-lang/grain/issues/1623))
53
+ * **stdlib:** Replace bigint/number arithmetic functions with operators ([#1742](https://github.com/grain-lang/grain/issues/1742))
54
+ * **stdlib:** Update Operator `uint` operator Names ([#1738](https://github.com/grain-lang/grain/issues/1738))
55
+ * **stdlib:** Provide empty byte array from Bytes.make ([#1729](https://github.com/grain-lang/grain/issues/1729))
56
+ * **stdlib:** Add optimization for `Number.pow(Rational, Int)` ([#1716](https://github.com/grain-lang/grain/issues/1716))
57
+ * **compiler:** Custom box printing ([#1713](https://github.com/grain-lang/grain/issues/1713))
58
+ * **stdlib:** Update Buffer/Bytes to use new integer types ([#1704](https://github.com/grain-lang/grain/issues/1704))
59
+ * **compiler:** Require floats always have a digit on left & right of dot ([#1703](https://github.com/grain-lang/grain/issues/1703))
60
+ * **compiler:** Remove 32-bit numbers from `Number` type ([#1683](https://github.com/grain-lang/grain/issues/1683))
61
+ * **compiler:** Short integer values ([#1669](https://github.com/grain-lang/grain/issues/1669))
62
+ * **compiler:** Supply primitive types via the compiler ([#1667](https://github.com/grain-lang/grain/issues/1667))
63
+ * **stdlib:** Add `**` (pow) operator to Pervasives module ([#1690](https://github.com/grain-lang/grain/issues/1690))
64
+ * **compiler:** Remove Exclusive/Inclusive Ranges, provide as record via compiler ([#1616](https://github.com/grain-lang/grain/issues/1616))
65
+ * **stdlib:** Make queue and stack mutable & provide Immutable submodules ([#1479](https://github.com/grain-lang/grain/issues/1479))
66
+ * **compiler:** Disallow multiple `provide`s of the same value ([#1689](https://github.com/grain-lang/grain/issues/1689))
67
+ * **graindoc:** Only use original doc blocks when re-providing ([#1687](https://github.com/grain-lang/grain/issues/1687))
68
+ * **graindoc:** Support docblocks on submodules ([#1684](https://github.com/grain-lang/grain/issues/1684))
69
+ * **graindoc:** Remove section attribute ([#1681](https://github.com/grain-lang/grain/issues/1681))
70
+ * **compiler:** Explicit abstract types ([#1680](https://github.com/grain-lang/grain/issues/1680))
71
+ * **compiler:** Add Uint32 and Uint64 types ([#1531](https://github.com/grain-lang/grain/issues/1531))
72
+ * **stdlib:** Remove `cons` and `empty` from Pervasives ([#1657](https://github.com/grain-lang/grain/issues/1657))
73
+ * **stdlib:** Sys/File reading and writing operate on Bytes ([#1655](https://github.com/grain-lang/grain/issues/1655))
74
+ * **compiler:** Make List a language-supplied type ([#1648](https://github.com/grain-lang/grain/issues/1648))
75
+ * **stdlib:** Use correct casing for BigInt module name
76
+ * **graindoc:** Replace module attribute with docblock on module header ([#1647](https://github.com/grain-lang/grain/issues/1647))
77
+ * **compiler:** Module system ([#1584](https://github.com/grain-lang/grain/issues/1584))
78
+ * **compiler:** Change Char internal representation ([#1622](https://github.com/grain-lang/grain/issues/1622))
79
+ * **compiler:** Inline record constructors ([#1586](https://github.com/grain-lang/grain/issues/1586))
80
+ * **stdlib:** Replace Number.nan & Number.infinity constants with keywords ([#1618](https://github.com/grain-lang/grain/issues/1618))
81
+ * **compiler:** Remove support of single-argument tuples ([#1608](https://github.com/grain-lang/grain/issues/1608))
82
+ * **stdlib:** `List.rotate` wraparound for count > length ([#1558](https://github.com/grain-lang/grain/issues/1558))
83
+ * **compiler:** Include Option and Result as language-supplied types ([#1591](https://github.com/grain-lang/grain/issues/1591))
84
+ * **stdlib:** Change array rotation direction ([#1552](https://github.com/grain-lang/grain/issues/1552))
85
+ * **stdlib:** Support zipping arrays of different sizes ([#1402](https://github.com/grain-lang/grain/issues/1402))
86
+ * **compiler:** Refactor enum constructors ([#1211](https://github.com/grain-lang/grain/issues/1211))
87
+
88
+ ### Features
89
+
90
+ * Add Hex Exponent Decimals ([8a69eb3](https://github.com/grain-lang/grain/commit/8a69eb31e4e22e6148c42ecd0efb677f3fbb222c))
91
+ * **cli:** Allow specifying WASI environment variables and CLI args ([#1840](https://github.com/grain-lang/grain/issues/1840)) ([fb8fbf2](https://github.com/grain-lang/grain/commit/fb8fbf2b8ca2a024e3983d25b52443337ec9746a))
92
+ * **compiler:** Add hex float syntax ([#1743](https://github.com/grain-lang/grain/issues/1743)) ([8a69eb3](https://github.com/grain-lang/grain/commit/8a69eb31e4e22e6148c42ecd0efb677f3fbb222c))
93
+ * **compiler:** Add Uint32 and Uint64 types ([#1531](https://github.com/grain-lang/grain/issues/1531)) ([42ffdc4](https://github.com/grain-lang/grain/commit/42ffdc408096901696abb6e3fa862b65d3d7e2a2))
94
+ * **compiler:** Change `->` to `=>` in type signatures ([#1855](https://github.com/grain-lang/grain/issues/1855)) ([b3d68a4](https://github.com/grain-lang/grain/commit/b3d68a4f2e99222a69d7066164892077f83ebf8c))
95
+ * **compiler:** Change Char internal representation ([#1622](https://github.com/grain-lang/grain/issues/1622)) ([58c9a51](https://github.com/grain-lang/grain/commit/58c9a5145a6c1c53e280657e4e41f79f2662eb8a))
96
+ * **compiler:** Changed comma to `and` in mutually rec types ([923625d](https://github.com/grain-lang/grain/commit/923625dfaf276be894546e67db66a17d00df9f14))
97
+ * **compiler:** Changed comma to `and` in recursive types and bindings ([#1827](https://github.com/grain-lang/grain/issues/1827)) ([923625d](https://github.com/grain-lang/grain/commit/923625dfaf276be894546e67db66a17d00df9f14))
98
+ * **compiler:** Custom box printing ([#1713](https://github.com/grain-lang/grain/issues/1713)) ([3c86e45](https://github.com/grain-lang/grain/commit/3c86e459235ad9bf0abbefb575021736ad45f310))
99
+ * **compiler:** Explicit abstract types ([#1680](https://github.com/grain-lang/grain/issues/1680)) ([58cd224](https://github.com/grain-lang/grain/commit/58cd2247441f16cfc95b415ad272da7a37b82fb5))
100
+ * **compiler:** Include Option and Result as language-supplied types ([#1591](https://github.com/grain-lang/grain/issues/1591)) ([bd5403f](https://github.com/grain-lang/grain/commit/bd5403f94f30366adc7d3307adc3c6c4fa5e1803))
101
+ * **compiler:** Inline record constructors ([#1586](https://github.com/grain-lang/grain/issues/1586)) ([43082f5](https://github.com/grain-lang/grain/commit/43082f52692d90b1419b6b72ebe66406a0a01d99))
102
+ * **compiler:** Labeled and default arguments ([#1623](https://github.com/grain-lang/grain/issues/1623)) ([28a38ac](https://github.com/grain-lang/grain/commit/28a38ac149d396cd034b6c53b0aa3eb478ed29ed))
103
+ * **compiler:** Make List a language-supplied type ([#1648](https://github.com/grain-lang/grain/issues/1648)) ([2ee1328](https://github.com/grain-lang/grain/commit/2ee13282427718d8849a334d085a3f833037127b))
104
+ * **compiler:** Make types nonrecursive by default ([#1826](https://github.com/grain-lang/grain/issues/1826)) ([46b8a5a](https://github.com/grain-lang/grain/commit/46b8a5aaa384eb52b34b82faea5b0a06adc22568))
105
+ * **compiler:** Module system ([#1584](https://github.com/grain-lang/grain/issues/1584)) ([752da69](https://github.com/grain-lang/grain/commit/752da69057b2b06a1415710d6da93fbb948e8185))
106
+ * **compiler:** Rational number type ([#1603](https://github.com/grain-lang/grain/issues/1603)) ([350f850](https://github.com/grain-lang/grain/commit/350f8503c3e6976275aaa8ee4d8c02554e7c238a))
107
+ * **compiler:** Reduce size of runtime heap ([#1807](https://github.com/grain-lang/grain/issues/1807)) ([246f894](https://github.com/grain-lang/grain/commit/246f894951be6ee4f2cb13df3d851583efc1498d))
108
+ * **compiler:** Refactor enum constructors ([#1211](https://github.com/grain-lang/grain/issues/1211)) ([8d465b7](https://github.com/grain-lang/grain/commit/8d465b7cd73d9549eeb89c7d52083d592ebd66fd))
109
+ * **compiler:** Remove 32-bit numbers from `Number` type ([#1683](https://github.com/grain-lang/grain/issues/1683)) ([50bf8ee](https://github.com/grain-lang/grain/commit/50bf8ee39d017805091fe1ae7536621e956c03ce))
110
+ * **compiler:** Remove arbitrary per-file compiler flags, add acceptable options as module attributes ([#1804](https://github.com/grain-lang/grain/issues/1804)) ([72b2139](https://github.com/grain-lang/grain/commit/72b21393b0c82669ff9005730cafb0b345a8a992))
111
+ * **compiler:** Remove Exclusive/Inclusive Ranges, provide as record via compiler ([#1616](https://github.com/grain-lang/grain/issues/1616)) ([49a399d](https://github.com/grain-lang/grain/commit/49a399dbcfc24957a3875ae094ad0a2c4b636a32))
112
+ * **compiler:** Remove Pervasives' dependency on toString when types are elided ([#1664](https://github.com/grain-lang/grain/issues/1664)) ([f703476](https://github.com/grain-lang/grain/commit/f703476db8d376d68a1c50fece48f335f455a791))
113
+ * **compiler:** Remove support of single-argument tuples ([#1608](https://github.com/grain-lang/grain/issues/1608)) ([509cd85](https://github.com/grain-lang/grain/commit/509cd85801eb165c0ce65347047a0380f2304b25))
114
+ * **compiler:** Require extension when including relative file paths ([#1842](https://github.com/grain-lang/grain/issues/1842)) ([dde62d3](https://github.com/grain-lang/grain/commit/dde62d39c501bd25cccac6569b426406711a5735))
115
+ * **compiler:** Short integer values ([#1669](https://github.com/grain-lang/grain/issues/1669)) ([fc4670d](https://github.com/grain-lang/grain/commit/fc4670de13c46dfac3def1ca59d718ffb36aca1c))
116
+ * **compiler:** Streamlined reference counting ([#1714](https://github.com/grain-lang/grain/issues/1714)) ([0711868](https://github.com/grain-lang/grain/commit/071186801ccf7f6dc3eef653382f6d82b8b23b6c))
117
+ * **compiler:** Supply primitive types via the compiler ([#1667](https://github.com/grain-lang/grain/issues/1667)) ([b41feb7](https://github.com/grain-lang/grain/commit/b41feb73976d4ef3d9c17c31f0dbcfc22df32d9d))
118
+ * **compiler:** Update include syntax ([#2043](https://github.com/grain-lang/grain/issues/2043)) ([5f44d4e](https://github.com/grain-lang/grain/commit/5f44d4e5a1cd432faddcfb1a138ac6a7797423fd))
119
+ * **compiler:** Update use syntax ([#2041](https://github.com/grain-lang/grain/issues/2041)) ([cd346ab](https://github.com/grain-lang/grain/commit/cd346ab761aaa5e8e7692ebce1bae4e5e7e47f45))
120
+ * **graindoc:** Allow doc comments on variants and record fields ([#1852](https://github.com/grain-lang/grain/issues/1852)) ([53f770c](https://github.com/grain-lang/grain/commit/53f770c24ef9057b7b5e63d3dda75b166c28536d))
121
+ * **graindoc:** Improve docgen for labeled & default arguments ([#1776](https://github.com/grain-lang/grain/issues/1776)) ([be7ff9d](https://github.com/grain-lang/grain/commit/be7ff9d9ec2237ad5028f8d9e3e2f10a6bd3f9dd))
122
+ * **graindoc:** Only use original doc blocks when re-providing ([#1687](https://github.com/grain-lang/grain/issues/1687)) ([97c7ce4](https://github.com/grain-lang/grain/commit/97c7ce4dfb7e4474358a62c3699dd3edc121c961))
123
+ * **graindoc:** Replace module attribute with docblock on module header ([#1647](https://github.com/grain-lang/grain/issues/1647)) ([2ff9d9e](https://github.com/grain-lang/grain/commit/2ff9d9ec49c727778c6d0ee74219f746df8a11e2))
124
+ * **graindoc:** Support docblocks on submodules ([#1684](https://github.com/grain-lang/grain/issues/1684)) ([bc13017](https://github.com/grain-lang/grain/commit/bc1301751c90380e53c0ca9048a928468245d13c))
125
+ * **grainfmt:** Implement new formatter ([#1976](https://github.com/grain-lang/grain/issues/1976)) ([1568aa0](https://github.com/grain-lang/grain/commit/1568aa06f625c4d91d9151e3f969ec648e8d4231))
126
+ * Remove js-runner ([#1585](https://github.com/grain-lang/grain/issues/1585)) ([e10d612](https://github.com/grain-lang/grain/commit/e10d61295c42237b7b472cd3c5d07f2c5f28d79b))
127
+ * Rework preopened directories ([#1656](https://github.com/grain-lang/grain/issues/1656)) ([7d3006d](https://github.com/grain-lang/grain/commit/7d3006d86d423a0bb03a600c6bf9726efc8394b9))
128
+ * **runtime:** Allow modulo on floating point numbers ([#1914](https://github.com/grain-lang/grain/issues/1914)) ([f90d8af](https://github.com/grain-lang/grain/commit/f90d8af2ee2373b5420655c9e80826f56fffaa91))
129
+ * **stdlib:** `List.rotate` wraparound for count > length ([#1558](https://github.com/grain-lang/grain/issues/1558)) ([6dd9680](https://github.com/grain-lang/grain/commit/6dd968009b5d700f2e31ed6f4b1074dbdc4299e7))
130
+ * **stdlib:** Add `**` (pow) operator to Pervasives module ([#1690](https://github.com/grain-lang/grain/issues/1690)) ([b16b455](https://github.com/grain-lang/grain/commit/b16b4552952fd554657ac1b5bcc868dca0600476))
131
+ * **stdlib:** Add `**` operator to `Int32` module ([#1938](https://github.com/grain-lang/grain/issues/1938)) ([32b9639](https://github.com/grain-lang/grain/commit/32b9639be58408d587f9c9c29a4b56857e6f328f))
132
+ * **stdlib:** Add `**` operator to `Int64` module ([#1937](https://github.com/grain-lang/grain/issues/1937)) ([48de28b](https://github.com/grain-lang/grain/commit/48de28bba8be2e157cfb82e90e709759659ab3b4))
133
+ * **stdlib:** Add `==` operator to `Queue` module ([#1931](https://github.com/grain-lang/grain/issues/1931)) ([3c0ea18](https://github.com/grain-lang/grain/commit/3c0ea189298d9bc4f14824a76814e9181e57a879))
134
+ * **stdlib:** Add `addCharFromCodePoint` to Buffer module ([#1883](https://github.com/grain-lang/grain/issues/1883)) ([18b553a](https://github.com/grain-lang/grain/commit/18b553a6f69876941bc7153c4e44d4db5547d86b))
135
+ * **stdlib:** Add `asin`, `acos`, `atan`, `isClose` to Number module ([#1699](https://github.com/grain-lang/grain/issues/1699)) ([353b544](https://github.com/grain-lang/grain/commit/353b544948861d39cbeef97273f661eed2e9748d))
136
+ * **stdlib:** Add `atan2` to the `Number` module ([#2016](https://github.com/grain-lang/grain/issues/2016)) ([145b783](https://github.com/grain-lang/grain/commit/145b783f234d9f6d6bdbe730877a5a53d125cb93))
137
+ * **stdlib:** Add `chunk` function to Array module ([#1708](https://github.com/grain-lang/grain/issues/1708)) ([fba7c1d](https://github.com/grain-lang/grain/commit/fba7c1d18447917d7544e780353684452321b38e))
138
+ * **stdlib:** Add `fromArray` to `Queue` module ([#1932](https://github.com/grain-lang/grain/issues/1932)) ([1c35a94](https://github.com/grain-lang/grain/commit/1c35a9438008d40c8d3a49810131c69d9b8b97a0))
139
+ * **stdlib:** Add `isEmpty` to `List` module ([#1860](https://github.com/grain-lang/grain/issues/1860)) ([7362189](https://github.com/grain-lang/grain/commit/736218950e7433512554f1b5fea4bc5cbfe97160))
140
+ * **stdlib:** add `isEmpty` to `String` module ([#1861](https://github.com/grain-lang/grain/issues/1861)) ([e8cb932](https://github.com/grain-lang/grain/commit/e8cb93298cf8776876efc7972f09f0eef2d57c58))
141
+ * **stdlib:** Add `Json` module ([#1133](https://github.com/grain-lang/grain/issues/1133)) ([5a6e4c6](https://github.com/grain-lang/grain/commit/5a6e4c6111ff84b3249436d485d4c45ef0a89d61))
142
+ * **stdlib:** Add `linearInterpolate`, `linearMap` and `clamp` ([#1707](https://github.com/grain-lang/grain/issues/1707)) ([15842a1](https://github.com/grain-lang/grain/commit/15842a1030e9c0937d7cd697508b083ae06315a7))
143
+ * **stdlib:** Add `print` suffix default argument ([#1768](https://github.com/grain-lang/grain/issues/1768)) ([6701170](https://github.com/grain-lang/grain/commit/6701170a1ecd91a8b7cb566d2ff99402d24c18e1))
144
+ * **stdlib:** Add `toArray` to `Queue` ([#1930](https://github.com/grain-lang/grain/issues/1930)) ([7c865a4](https://github.com/grain-lang/grain/commit/7c865a46811ee078325f55ebcaa054c9f1920ff6))
145
+ * **stdlib:** Add `toIntegerRatio` and `fromIntegerRatio` to Rational Library ([#1746](https://github.com/grain-lang/grain/issues/1746)) ([008a735](https://github.com/grain-lang/grain/commit/008a735051c02fbcd7bd47d7735937a61afd0cd6))
146
+ * **stdlib:** Add `toList` and `fromList` functions to `Queue` module ([#1866](https://github.com/grain-lang/grain/issues/1866)) ([7cdcf95](https://github.com/grain-lang/grain/commit/7cdcf953d451396e56122bcf062019171102d8d6))
147
+ * **stdlib:** Add `Uri` module ([#1970](https://github.com/grain-lang/grain/issues/1970)) ([5cf726e](https://github.com/grain-lang/grain/commit/5cf726edb06ef42a9c8c073fbd3407defe501a49))
148
+ * **stdlib:** Add ASCII utilities to String, Char ([#1975](https://github.com/grain-lang/grain/issues/1975)) ([f65002d](https://github.com/grain-lang/grain/commit/f65002d8c16c927577a4593351882c0734dd9897))
149
+ * **stdlib:** Add optimization for `Number.pow(Rational, Int)` ([#1716](https://github.com/grain-lang/grain/issues/1716)) ([67bee5c](https://github.com/grain-lang/grain/commit/67bee5c0982d35f0d6a1350e002b7062a498afe7))
150
+ * **stdlib:** Change array rotation direction ([#1552](https://github.com/grain-lang/grain/issues/1552)) ([bbe56ad](https://github.com/grain-lang/grain/commit/bbe56ade517bd685d52384d32aecb94d25d379f7))
151
+ * **stdlib:** Convert unsafe `Wasm` functions to operators ([#1734](https://github.com/grain-lang/grain/issues/1734)) ([114d17b](https://github.com/grain-lang/grain/commit/114d17be4463772bbc84ebc408e9cf2b482c6103))
152
+ * **stdlib:** Handle printing of reference cycles ([#1844](https://github.com/grain-lang/grain/issues/1844)) ([49c854e](https://github.com/grain-lang/grain/commit/49c854eb428ebbe57db5a63d5e7f87faaded3159))
153
+ * **stdlib:** Make queue and stack mutable & provide Immutable submodules ([#1479](https://github.com/grain-lang/grain/issues/1479)) ([979a20c](https://github.com/grain-lang/grain/commit/979a20ce6b734b90bc38c11ee6a4534ea8e555b8))
154
+ * **stdlib:** Move stdlib `sys` modules to `wasi` ([#2056](https://github.com/grain-lang/grain/issues/2056)) ([ca75e38](https://github.com/grain-lang/grain/commit/ca75e38a2bbadd1a5e51f7ab344994d62c96ca4f))
155
+ * **stdlib:** Provide empty byte array from Bytes.make ([#1729](https://github.com/grain-lang/grain/issues/1729)) ([fde3064](https://github.com/grain-lang/grain/commit/fde3064428fa2244e73932d5992ac722a26ebfe4))
156
+ * **stdlib:** Remove parseInt dependency on Pervasives ([#1649](https://github.com/grain-lang/grain/issues/1649)) ([9408568](https://github.com/grain-lang/grain/commit/9408568a3457c2084afc22f958334e87a4183ccf))
157
+ * **stdlib:** Reorder parameters to `List.insert` ([#1857](https://github.com/grain-lang/grain/issues/1857)) ([973f3f3](https://github.com/grain-lang/grain/commit/973f3f34c39a4ac7a552e378b84020d5c647ce86))
158
+ * **stdlib:** Replace `Float32` arithmatic/comparison functions with operators ([#1954](https://github.com/grain-lang/grain/issues/1954)) ([52cc15a](https://github.com/grain-lang/grain/commit/52cc15a5251cd0003fcfbe243c7b7c940a61d429))
159
+ * **stdlib:** Replace `Float64` arithmatic/comparison functions with operators ([#1957](https://github.com/grain-lang/grain/issues/1957)) ([dea4cb5](https://github.com/grain-lang/grain/commit/dea4cb54d10b9cecbf54ed30048c0937bc38cea2))
160
+ * **stdlib:** Replace `Int32` arithmatic functions with operators ([#1936](https://github.com/grain-lang/grain/issues/1936)) ([8a69dd3](https://github.com/grain-lang/grain/commit/8a69dd393e002585464029a42a4362b6edfee662))
161
+ * **stdlib:** Replace `Int64` arithmatic functions with operators ([#1935](https://github.com/grain-lang/grain/issues/1935)) ([cfb909c](https://github.com/grain-lang/grain/commit/cfb909c60d55d94eb869c389da28a8b3a1bc502f))
162
+ * **stdlib:** Replace `Result`/`Option` `and`/`or` functions with operators ([#1821](https://github.com/grain-lang/grain/issues/1821)) ([686de7e](https://github.com/grain-lang/grain/commit/686de7ec3c83d092c7a0407657695e1bc671abd7))
163
+ * **stdlib:** Simplify `equal` using `Memory.compare` ([#1972](https://github.com/grain-lang/grain/issues/1972)) ([dc21976](https://github.com/grain-lang/grain/commit/dc219763ebc7bcfcd6c411d7b2b1f152e5e87d6e))
164
+ * **stdlib:** Support zipping arrays of different sizes ([#1402](https://github.com/grain-lang/grain/issues/1402)) ([b8ae3d6](https://github.com/grain-lang/grain/commit/b8ae3d69c98ada45bc592fb3097f21bc8a0d40bd))
165
+ * **stdlib:** Use Array length as default end in `Array.slice` function ([#1762](https://github.com/grain-lang/grain/issues/1762)) ([a698fdc](https://github.com/grain-lang/grain/commit/a698fdc55ef45e8b0d156d5bb3cacc9e21d758ac))
166
+ * **stdlib:** Use String length as default end in `String.slice` function ([#1748](https://github.com/grain-lang/grain/issues/1748)) ([b7c41a6](https://github.com/grain-lang/grain/commit/b7c41a6421dd0392bfec9f1791d9314556af9318))
167
+
168
+
169
+ ### Bug Fixes
170
+
171
+ * **compiler:** Disallow multiple `provide`s of the same value ([#1689](https://github.com/grain-lang/grain/issues/1689)) ([7ab7ddc](https://github.com/grain-lang/grain/commit/7ab7ddc1c7e9eae221edcf787b733ef7acf97904))
172
+ * **compiler:** Remove static runtime pointers ([#1806](https://github.com/grain-lang/grain/issues/1806)) ([8d76dc9](https://github.com/grain-lang/grain/commit/8d76dc917cf109e3b8496faca565fd9904fa0b22))
173
+ * Fix String.ReplaceAll ([#1705](https://github.com/grain-lang/grain/issues/1705)) ([d3af004](https://github.com/grain-lang/grain/commit/d3af0049f6910b10065ddd72c46e5364fe53c4ff))
174
+ * **stdlib:** Ensure `Array.fillRange` works with negative indexing & throws IndexOutOfBound ([#1761](https://github.com/grain-lang/grain/issues/1761)) ([3c3c4d9](https://github.com/grain-lang/grain/commit/3c3c4d9ced8168287ecbd23ee71948c5592e3b66))
175
+ * **stdlib:** Ensure consistent marshal representation ([#2045](https://github.com/grain-lang/grain/issues/2045)) ([029059f](https://github.com/grain-lang/grain/commit/029059fbeed185a2e467a014bbc313fda4b87c5e))
176
+ * **stdlib:** Error when `relativeTo` used on relative source and absolute dest ([#2054](https://github.com/grain-lang/grain/issues/2054)) ([1626a1f](https://github.com/grain-lang/grain/commit/1626a1fd8b621c6bcc359dab48b4495a0db21e14))
177
+ * **stdlib:** Fix overzealous Memory.fill in Buffer.truncate ([#1781](https://github.com/grain-lang/grain/issues/1781)) ([e1f24e9](https://github.com/grain-lang/grain/commit/e1f24e941a392f1ac6464683d71f87eab6787220))
178
+ * **stdlib:** Properly handle extremely large integer bases in `Number.(**)` ([#1950](https://github.com/grain-lang/grain/issues/1950)) ([84c076f](https://github.com/grain-lang/grain/commit/84c076fb3b7b34a3fec6dfd2c527ca4833414ff4))
179
+ * **stdlib:** Properly resize empty Queue on push ([#1865](https://github.com/grain-lang/grain/issues/1865)) ([f7727ef](https://github.com/grain-lang/grain/commit/f7727ef2158f63dc8c88a5b824b41e31495f0f51))
180
+ * **stdlib:** Properly resize empty Stack on push ([#1867](https://github.com/grain-lang/grain/issues/1867)) ([b90d924](https://github.com/grain-lang/grain/commit/b90d924a38f8a7f82a7c972f8213ab9ec8561820))
181
+ * **stdlib:** Remove extra space when converting Bytes to String ([#1800](https://github.com/grain-lang/grain/issues/1800)) ([543807b](https://github.com/grain-lang/grain/commit/543807b1156aecc93396c12121ada15f4d2bd046))
182
+ * **stdlib:** Return early from `Process.argv()` if length is zero ([#1817](https://github.com/grain-lang/grain/issues/1817)) ([8ccea28](https://github.com/grain-lang/grain/commit/8ccea288feb7f981adaecd29ba1324fefb192b69))
183
+ * **stdlib:** Sys/File reading and writing operate on Bytes ([#1655](https://github.com/grain-lang/grain/issues/1655)) ([17cb28d](https://github.com/grain-lang/grain/commit/17cb28d25f4b1f2cf8943429136c863f66447675))
184
+ * **stdlib:** Use correct casing for BigInt module name ([2ff9d9e](https://github.com/grain-lang/grain/commit/2ff9d9ec49c727778c6d0ee74219f746df8a11e2))
185
+
186
+
187
+ ### Miscellaneous Chores
188
+
189
+ * **compiler:** Optimize type metadata loading ([#1741](https://github.com/grain-lang/grain/issues/1741)) ([a4519bc](https://github.com/grain-lang/grain/commit/a4519bc88d9fe12159495e995fcaa74834d5a361))
190
+ * **compiler:** Require floats always have a digit on left & right of dot ([#1703](https://github.com/grain-lang/grain/issues/1703)) ([b657e1c](https://github.com/grain-lang/grain/commit/b657e1cf68d4b20bfb06d662b1fc8687836e5104))
191
+ * **graindoc:** Remove section attribute ([#1681](https://github.com/grain-lang/grain/issues/1681)) ([e969ad7](https://github.com/grain-lang/grain/commit/e969ad75e017785d12decbbf87651bd8c7dd286d))
192
+ * Require node version >=18.15 for WASI support ([#1612](https://github.com/grain-lang/grain/issues/1612)) ([331ffc2](https://github.com/grain-lang/grain/commit/331ffc28b57e7e52fc9e360d1d85f81d3a172d06))
193
+ * **stdlib:** Group mutable/immutable data structures ([#1652](https://github.com/grain-lang/grain/issues/1652)) ([f93afef](https://github.com/grain-lang/grain/commit/f93afef3785910ebbedcf780ce2d6109299c2e86))
194
+ * **stdlib:** Remove `cons` and `empty` from Pervasives ([#1657](https://github.com/grain-lang/grain/issues/1657)) ([f6f02bc](https://github.com/grain-lang/grain/commit/f6f02bcb5a196f7f611ee6604f8585d429368314))
195
+ * **stdlib:** Remove `sin`, `cos`, `tan`, `gamma`, `factorial` from `Number` module ([#2046](https://github.com/grain-lang/grain/issues/2046)) ([85c4389](https://github.com/grain-lang/grain/commit/85c4389dee9f0760e40639df5112294cb4cc44cb))
196
+ * **stdlib:** Replace `parseInt` error strings with structured error enum ([#1755](https://github.com/grain-lang/grain/issues/1755)) ([ea26d18](https://github.com/grain-lang/grain/commit/ea26d1814558730507517d4939abed6767aaaf24))
197
+ * **stdlib:** Replace bigint/number arithmetic functions with operators ([#1742](https://github.com/grain-lang/grain/issues/1742)) ([cbd46ee](https://github.com/grain-lang/grain/commit/cbd46ee99654d066690f1eb13bde8d882abed80f))
198
+ * **stdlib:** Replace Number.nan & Number.infinity constants with keywords ([#1618](https://github.com/grain-lang/grain/issues/1618)) ([b437c13](https://github.com/grain-lang/grain/commit/b437c131aedcc4395080179b8e0d41ff6b2c95b2))
199
+ * **stdlib:** Switch to using records for `getInternalStats` ([#1898](https://github.com/grain-lang/grain/issues/1898)) ([bdb119a](https://github.com/grain-lang/grain/commit/bdb119a8234409c5425a2f8678d53237eb7af850))
200
+ * **stdlib:** Update Buffer/Bytes to use new integer types ([#1704](https://github.com/grain-lang/grain/issues/1704)) ([d508e5a](https://github.com/grain-lang/grain/commit/d508e5af7d66e8419370000030ee40194052301f))
201
+ * **stdlib:** Update Operator `uint` operator Names ([#1738](https://github.com/grain-lang/grain/issues/1738)) ([decb053](https://github.com/grain-lang/grain/commit/decb0533e87cb8d617e27c0f5470a24c502dcfab))
202
+ * **stdlib:** Use default arguments in more of stdlib ([#1772](https://github.com/grain-lang/grain/issues/1772)) ([f5e934f](https://github.com/grain-lang/grain/commit/f5e934fc658427b698cfb3919c9b2ac411a0ce45))
203
+
3
204
  ### [0.5.13](https://github.com/grain-lang/grain/compare/stdlib-v0.5.12...stdlib-v0.5.13) (2023-01-07)
4
205
 
5
206
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2022 Oscar Spencer <oscar@grain-lang.org> and Philip Blair <philip@grain-lang.org>
3
+ Copyright (c) 2017-2023 Oscar Spencer <oscar@grain-lang.org> and Philip Blair <philip@grain-lang.org>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -21,8 +21,9 @@ Grain programs will search for an imported module in the `stdlib` if not availab
21
21
  For example, you can import the `number` stdlib:
22
22
 
23
23
  ```grain
24
- import Number from "number"
25
- Number.abs(-1)
24
+ module Main
25
+ from "number" include Number
26
+ assert Number.abs(-1) == 1
26
27
  ```
27
28
 
28
29
  ## API
@@ -32,3 +33,25 @@ This package includes generated markdown documentation, but we recommend using o
32
33
  ## License
33
34
 
34
35
  MIT
36
+
37
+ ## Contributing
38
+
39
+ If you want to contribute to the `stdlib`, please consider the guidelines [here](https://github.com/grain-lang/grain/blob/main/docs/contributor/standard_library.md), if you want something to work on you can find open issues [here](https://github.com/grain-lang/grain/issues?q=is%3Aopen+is%3Aissue+label%3Astdlib).
40
+
41
+ To regenerate the `stdlib`` documentation you can run:
42
+
43
+ ```sh
44
+ grain doc stdlib -o stdlib --current-version=$(grain -v)
45
+ ```
46
+
47
+ To format the `stdlib` you can run:
48
+
49
+ ```sh
50
+ grain format ./stdlib/ -o ./stdlib/
51
+ ```
52
+
53
+ To run the `stdlib` tests you can run:
54
+
55
+ ```sh
56
+ npm run compiler test -- --filter stdlib
57
+ ```