@grain/stdlib 0.5.12 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/CHANGELOG.md +200 -0
  2. package/LICENSE +1 -1
  3. package/README.md +25 -2
  4. package/array.gr +1512 -199
  5. package/array.md +2032 -94
  6. package/bigint.gr +239 -140
  7. package/bigint.md +450 -106
  8. package/buffer.gr +595 -102
  9. package/buffer.md +903 -145
  10. package/bytes.gr +401 -110
  11. package/bytes.md +551 -63
  12. package/char.gr +228 -49
  13. package/char.md +373 -7
  14. package/exception.gr +26 -12
  15. package/exception.md +29 -5
  16. package/float32.gr +130 -109
  17. package/float32.md +185 -57
  18. package/float64.gr +112 -99
  19. package/float64.md +185 -57
  20. package/hash.gr +47 -37
  21. package/hash.md +21 -3
  22. package/int16.gr +430 -0
  23. package/int16.md +618 -0
  24. package/int32.gr +200 -269
  25. package/int32.md +254 -289
  26. package/int64.gr +142 -225
  27. package/int64.md +254 -289
  28. package/int8.gr +511 -0
  29. package/int8.md +786 -0
  30. package/json.gr +2084 -0
  31. package/json.md +608 -0
  32. package/list.gr +120 -68
  33. package/list.md +125 -80
  34. package/map.gr +560 -57
  35. package/map.md +672 -56
  36. package/marshal.gr +239 -227
  37. package/marshal.md +36 -4
  38. package/number.gr +626 -676
  39. package/number.md +738 -153
  40. package/option.gr +33 -35
  41. package/option.md +58 -42
  42. package/package.json +2 -2
  43. package/path.gr +148 -187
  44. package/path.md +47 -96
  45. package/pervasives.gr +75 -416
  46. package/pervasives.md +85 -180
  47. package/priorityqueue.gr +433 -74
  48. package/priorityqueue.md +422 -54
  49. package/queue.gr +362 -80
  50. package/queue.md +433 -38
  51. package/random.gr +67 -75
  52. package/random.md +68 -40
  53. package/range.gr +135 -63
  54. package/range.md +198 -43
  55. package/rational.gr +284 -0
  56. package/rational.md +545 -0
  57. package/regex.gr +933 -1066
  58. package/regex.md +59 -60
  59. package/result.gr +23 -25
  60. package/result.md +54 -39
  61. package/runtime/atof/common.gr +78 -82
  62. package/runtime/atof/common.md +22 -10
  63. package/runtime/atof/decimal.gr +102 -127
  64. package/runtime/atof/decimal.md +28 -7
  65. package/runtime/atof/lemire.gr +56 -71
  66. package/runtime/atof/lemire.md +9 -1
  67. package/runtime/atof/parse.gr +83 -110
  68. package/runtime/atof/parse.md +12 -2
  69. package/runtime/atof/slow.gr +28 -35
  70. package/runtime/atof/slow.md +9 -1
  71. package/runtime/atof/table.gr +19 -18
  72. package/runtime/atof/table.md +10 -2
  73. package/runtime/atoi/parse.gr +153 -136
  74. package/runtime/atoi/parse.md +50 -1
  75. package/runtime/bigint.gr +410 -517
  76. package/runtime/bigint.md +71 -57
  77. package/runtime/compare.gr +176 -85
  78. package/runtime/compare.md +31 -1
  79. package/runtime/dataStructures.gr +144 -32
  80. package/runtime/dataStructures.md +267 -31
  81. package/runtime/debugPrint.gr +34 -15
  82. package/runtime/debugPrint.md +37 -5
  83. package/runtime/equal.gr +53 -52
  84. package/runtime/equal.md +30 -1
  85. package/runtime/exception.gr +38 -47
  86. package/runtime/exception.md +10 -8
  87. package/runtime/gc.gr +23 -152
  88. package/runtime/gc.md +13 -17
  89. package/runtime/malloc.gr +31 -31
  90. package/runtime/malloc.md +11 -3
  91. package/runtime/numberUtils.gr +191 -172
  92. package/runtime/numberUtils.md +17 -9
  93. package/runtime/numbers.gr +1695 -1021
  94. package/runtime/numbers.md +1098 -134
  95. package/runtime/string.gr +540 -242
  96. package/runtime/string.md +76 -6
  97. package/runtime/unsafe/constants.gr +30 -13
  98. package/runtime/unsafe/constants.md +80 -0
  99. package/runtime/unsafe/conv.gr +55 -28
  100. package/runtime/unsafe/conv.md +41 -9
  101. package/runtime/unsafe/memory.gr +10 -30
  102. package/runtime/unsafe/memory.md +15 -19
  103. package/runtime/unsafe/tags.gr +37 -21
  104. package/runtime/unsafe/tags.md +88 -8
  105. package/runtime/unsafe/wasmf32.gr +30 -36
  106. package/runtime/unsafe/wasmf32.md +64 -56
  107. package/runtime/unsafe/wasmf64.gr +30 -36
  108. package/runtime/unsafe/wasmf64.md +64 -56
  109. package/runtime/unsafe/wasmi32.gr +49 -66
  110. package/runtime/unsafe/wasmi32.md +102 -94
  111. package/runtime/unsafe/wasmi64.gr +52 -79
  112. package/runtime/unsafe/wasmi64.md +108 -100
  113. package/runtime/utils/printing.gr +13 -15
  114. package/runtime/utils/printing.md +11 -3
  115. package/runtime/wasi.gr +294 -295
  116. package/runtime/wasi.md +62 -42
  117. package/set.gr +574 -64
  118. package/set.md +634 -54
  119. package/stack.gr +181 -64
  120. package/stack.md +271 -42
  121. package/string.gr +453 -533
  122. package/string.md +241 -151
  123. package/uint16.gr +369 -0
  124. package/uint16.md +585 -0
  125. package/uint32.gr +470 -0
  126. package/uint32.md +737 -0
  127. package/uint64.gr +471 -0
  128. package/uint64.md +737 -0
  129. package/uint8.gr +369 -0
  130. package/uint8.md +585 -0
  131. package/uri.gr +1093 -0
  132. package/uri.md +477 -0
  133. package/{sys → wasi}/file.gr +914 -500
  134. package/{sys → wasi}/file.md +454 -50
  135. package/wasi/process.gr +292 -0
  136. package/{sys → wasi}/process.md +164 -6
  137. package/wasi/random.gr +77 -0
  138. package/wasi/random.md +80 -0
  139. package/{sys → wasi}/time.gr +15 -22
  140. package/{sys → wasi}/time.md +5 -5
  141. package/immutablearray.gr +0 -929
  142. package/immutablearray.md +0 -1038
  143. package/immutablemap.gr +0 -493
  144. package/immutablemap.md +0 -479
  145. package/immutablepriorityqueue.gr +0 -360
  146. package/immutablepriorityqueue.md +0 -291
  147. package/immutableset.gr +0 -498
  148. package/immutableset.md +0 -449
  149. package/runtime/debug.gr +0 -2
  150. package/runtime/debug.md +0 -6
  151. package/runtime/unsafe/errors.gr +0 -36
  152. package/runtime/unsafe/errors.md +0 -204
  153. package/sys/process.gr +0 -254
  154. package/sys/random.gr +0 -79
  155. package/sys/random.md +0 -66
package/runtime/wasi.md CHANGED
@@ -1,55 +1,63 @@
1
+ ---
2
+ title: Wasi
3
+ ---
4
+
5
+ ## Values
6
+
7
+ Functions and constants included in the Wasi module.
8
+
1
9
  ### Wasi.**args_get**
2
10
 
3
11
  ```grain
4
- args_get : (WasmI32, WasmI32) -> WasmI32
12
+ args_get : (WasmI32, WasmI32) => WasmI32
5
13
  ```
6
14
 
7
15
  ### Wasi.**args_sizes_get**
8
16
 
9
17
  ```grain
10
- args_sizes_get : (WasmI32, WasmI32) -> WasmI32
18
+ args_sizes_get : (WasmI32, WasmI32) => WasmI32
11
19
  ```
12
20
 
13
21
  ### Wasi.**environ_get**
14
22
 
15
23
  ```grain
16
- environ_get : (WasmI32, WasmI32) -> WasmI32
24
+ environ_get : (WasmI32, WasmI32) => WasmI32
17
25
  ```
18
26
 
19
27
  ### Wasi.**environ_sizes_get**
20
28
 
21
29
  ```grain
22
- environ_sizes_get : (WasmI32, WasmI32) -> WasmI32
30
+ environ_sizes_get : (WasmI32, WasmI32) => WasmI32
23
31
  ```
24
32
 
25
33
  ### Wasi.**proc_exit**
26
34
 
27
35
  ```grain
28
- proc_exit : WasmI32 -> Void
36
+ proc_exit : WasmI32 => Void
29
37
  ```
30
38
 
31
39
  ### Wasi.**proc_raise**
32
40
 
33
41
  ```grain
34
- proc_raise : WasmI32 -> WasmI32
42
+ proc_raise : WasmI32 => WasmI32
35
43
  ```
36
44
 
37
45
  ### Wasi.**sched_yield**
38
46
 
39
47
  ```grain
40
- sched_yield : () -> WasmI32
48
+ sched_yield : () => WasmI32
41
49
  ```
42
50
 
43
51
  ### Wasi.**random_get**
44
52
 
45
53
  ```grain
46
- random_get : (WasmI32, WasmI32) -> WasmI32
54
+ random_get : (WasmI32, WasmI32) => WasmI32
47
55
  ```
48
56
 
49
57
  ### Wasi.**clock_time_get**
50
58
 
51
59
  ```grain
52
- clock_time_get : (WasmI32, WasmI64, WasmI32) -> WasmI32
60
+ clock_time_get : (WasmI32, WasmI64, WasmI32) => WasmI32
53
61
  ```
54
62
 
55
63
  ### Wasi.**path_open**
@@ -57,25 +65,37 @@ clock_time_get : (WasmI32, WasmI64, WasmI32) -> WasmI32
57
65
  ```grain
58
66
  path_open :
59
67
  (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI64, WasmI64, WasmI32,
60
- WasmI32) -> WasmI32
68
+ WasmI32) => WasmI32
61
69
  ```
62
70
 
63
71
  ### Wasi.**fd_read**
64
72
 
65
73
  ```grain
66
- fd_read : (WasmI32, WasmI32, WasmI32, WasmI32) -> WasmI32
74
+ fd_read : (WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32
67
75
  ```
68
76
 
69
77
  ### Wasi.**fd_pread**
70
78
 
71
79
  ```grain
72
- fd_pread : (WasmI32, WasmI32, WasmI32, WasmI64, WasmI32) -> WasmI32
80
+ fd_pread : (WasmI32, WasmI32, WasmI32, WasmI64, WasmI32) => WasmI32
81
+ ```
82
+
83
+ ### Wasi.**fd_prestat_get**
84
+
85
+ ```grain
86
+ fd_prestat_get : (WasmI32, WasmI32) => WasmI32
87
+ ```
88
+
89
+ ### Wasi.**fd_prestat_dir_name**
90
+
91
+ ```grain
92
+ fd_prestat_dir_name : (WasmI32, WasmI32, WasmI32) => WasmI32
73
93
  ```
74
94
 
75
95
  ### Wasi.**fd_write**
76
96
 
77
97
  ```grain
78
- fd_write : (WasmI32, WasmI32, WasmI32, WasmI32) -> WasmI32
98
+ fd_write : (WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32
79
99
  ```
80
100
 
81
101
  Invokes the `fd_write` system call.
@@ -84,10 +104,10 @@ Parameters:
84
104
 
85
105
  |param|type|description|
86
106
  |-----|----|-----------|
87
- |`file_descriptor`|`WasmI32`|The file descriptor to write to|
88
- |`iovs`|`WasmI32`|The pointer to the array of iovs to write|
89
- |`iovs_len`|`WasmI32`|The length of the array of iovs|
90
- |`nwritten`|`WasmI32`|Where to store the number of bytes written|
107
+ |`0`|`WasmI32`|The file descriptor to write to|
108
+ |`1`|`WasmI32`|The pointer to the array of iovs to write|
109
+ |`2`|`WasmI32`|The length of the array of iovs|
110
+ |`3`|`WasmI32`|Where to store the number of bytes written|
91
111
 
92
112
  Returns:
93
113
 
@@ -98,149 +118,149 @@ Returns:
98
118
  ### Wasi.**fd_pwrite**
99
119
 
100
120
  ```grain
101
- fd_pwrite : (WasmI32, WasmI32, WasmI32, WasmI64, WasmI32) -> WasmI32
121
+ fd_pwrite : (WasmI32, WasmI32, WasmI32, WasmI64, WasmI32) => WasmI32
102
122
  ```
103
123
 
104
124
  ### Wasi.**fd_allocate**
105
125
 
106
126
  ```grain
107
- fd_allocate : (WasmI32, WasmI64, WasmI64) -> WasmI32
127
+ fd_allocate : (WasmI32, WasmI64, WasmI64) => WasmI32
108
128
  ```
109
129
 
110
130
  ### Wasi.**fd_close**
111
131
 
112
132
  ```grain
113
- fd_close : WasmI32 -> WasmI32
133
+ fd_close : WasmI32 => WasmI32
114
134
  ```
115
135
 
116
136
  ### Wasi.**fd_datasync**
117
137
 
118
138
  ```grain
119
- fd_datasync : WasmI32 -> WasmI32
139
+ fd_datasync : WasmI32 => WasmI32
120
140
  ```
121
141
 
122
142
  ### Wasi.**fd_sync**
123
143
 
124
144
  ```grain
125
- fd_sync : WasmI32 -> WasmI32
145
+ fd_sync : WasmI32 => WasmI32
126
146
  ```
127
147
 
128
148
  ### Wasi.**fd_fdstat_get**
129
149
 
130
150
  ```grain
131
- fd_fdstat_get : (WasmI32, WasmI32) -> WasmI32
151
+ fd_fdstat_get : (WasmI32, WasmI32) => WasmI32
132
152
  ```
133
153
 
134
154
  ### Wasi.**fd_fdstat_set_flags**
135
155
 
136
156
  ```grain
137
- fd_fdstat_set_flags : (WasmI32, WasmI32) -> WasmI32
157
+ fd_fdstat_set_flags : (WasmI32, WasmI32) => WasmI32
138
158
  ```
139
159
 
140
160
  ### Wasi.**fd_fdstat_set_rights**
141
161
 
142
162
  ```grain
143
- fd_fdstat_set_rights : (WasmI32, WasmI64, WasmI64) -> WasmI32
163
+ fd_fdstat_set_rights : (WasmI32, WasmI64, WasmI64) => WasmI32
144
164
  ```
145
165
 
146
166
  ### Wasi.**fd_filestat_get**
147
167
 
148
168
  ```grain
149
- fd_filestat_get : (WasmI32, WasmI32) -> WasmI32
169
+ fd_filestat_get : (WasmI32, WasmI32) => WasmI32
150
170
  ```
151
171
 
152
172
  ### Wasi.**fd_filestat_set_size**
153
173
 
154
174
  ```grain
155
- fd_filestat_set_size : (WasmI32, WasmI64) -> WasmI32
175
+ fd_filestat_set_size : (WasmI32, WasmI64) => WasmI32
156
176
  ```
157
177
 
158
178
  ### Wasi.**fd_filestat_set_times**
159
179
 
160
180
  ```grain
161
- fd_filestat_set_times : (WasmI32, WasmI64, WasmI64, WasmI32) -> WasmI32
181
+ fd_filestat_set_times : (WasmI32, WasmI64, WasmI64, WasmI32) => WasmI32
162
182
  ```
163
183
 
164
184
  ### Wasi.**fd_readdir**
165
185
 
166
186
  ```grain
167
- fd_readdir : (WasmI32, WasmI32, WasmI32, WasmI64, WasmI32) -> WasmI32
187
+ fd_readdir : (WasmI32, WasmI32, WasmI32, WasmI64, WasmI32) => WasmI32
168
188
  ```
169
189
 
170
190
  ### Wasi.**fd_renumber**
171
191
 
172
192
  ```grain
173
- fd_renumber : (WasmI32, WasmI32) -> WasmI32
193
+ fd_renumber : (WasmI32, WasmI32) => WasmI32
174
194
  ```
175
195
 
176
196
  ### Wasi.**fd_seek**
177
197
 
178
198
  ```grain
179
- fd_seek : (WasmI32, WasmI64, WasmI32, WasmI32) -> WasmI32
199
+ fd_seek : (WasmI32, WasmI64, WasmI32, WasmI32) => WasmI32
180
200
  ```
181
201
 
182
202
  ### Wasi.**fd_tell**
183
203
 
184
204
  ```grain
185
- fd_tell : (WasmI32, WasmI32) -> WasmI32
205
+ fd_tell : (WasmI32, WasmI32) => WasmI32
186
206
  ```
187
207
 
188
208
  ### Wasi.**path_create_directory**
189
209
 
190
210
  ```grain
191
- path_create_directory : (WasmI32, WasmI32, WasmI32) -> WasmI32
211
+ path_create_directory : (WasmI32, WasmI32, WasmI32) => WasmI32
192
212
  ```
193
213
 
194
214
  ### Wasi.**path_filestat_get**
195
215
 
196
216
  ```grain
197
- path_filestat_get : (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) -> WasmI32
217
+ path_filestat_get : (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32
198
218
  ```
199
219
 
200
220
  ### Wasi.**path_filestat_set_times**
201
221
 
202
222
  ```grain
203
223
  path_filestat_set_times :
204
- (WasmI32, WasmI32, WasmI32, WasmI32, WasmI64, WasmI64, WasmI32) -> WasmI32
224
+ (WasmI32, WasmI32, WasmI32, WasmI32, WasmI64, WasmI64, WasmI32) => WasmI32
205
225
  ```
206
226
 
207
227
  ### Wasi.**path_link**
208
228
 
209
229
  ```grain
210
230
  path_link :
211
- (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) -> WasmI32
231
+ (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32
212
232
  ```
213
233
 
214
234
  ### Wasi.**path_symlink**
215
235
 
216
236
  ```grain
217
- path_symlink : (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) -> WasmI32
237
+ path_symlink : (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32
218
238
  ```
219
239
 
220
240
  ### Wasi.**path_unlink_file**
221
241
 
222
242
  ```grain
223
- path_unlink_file : (WasmI32, WasmI32, WasmI32) -> WasmI32
243
+ path_unlink_file : (WasmI32, WasmI32, WasmI32) => WasmI32
224
244
  ```
225
245
 
226
246
  ### Wasi.**path_readlink**
227
247
 
228
248
  ```grain
229
249
  path_readlink :
230
- (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) -> WasmI32
250
+ (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32
231
251
  ```
232
252
 
233
253
  ### Wasi.**path_remove_directory**
234
254
 
235
255
  ```grain
236
- path_remove_directory : (WasmI32, WasmI32, WasmI32) -> WasmI32
256
+ path_remove_directory : (WasmI32, WasmI32, WasmI32) => WasmI32
237
257
  ```
238
258
 
239
259
  ### Wasi.**path_rename**
240
260
 
241
261
  ```grain
242
262
  path_rename :
243
- (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) -> WasmI32
263
+ (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32
244
264
  ```
245
265
 
246
266
  ### Wasi.**_CLOCK_REALTIME**
@@ -834,6 +854,6 @@ _ENOTCAPABLE : WasmI32
834
854
  ### Wasi.**stringOfSystemError**
835
855
 
836
856
  ```grain
837
- stringOfSystemError : a -> String
857
+ stringOfSystemError : (code: a) => String
838
858
  ```
839
859