Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stdlib)!: Move stdlib sys modules to wasi #2056

Merged
merged 4 commits into from Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,6 +1,6 @@
module FileTest

from "sys/file" include File as Fs
from "wasi/file" include File as Fs
from "bytes" include Bytes
from "result" include Result

Expand Down
@@ -1,7 +1,7 @@
module ProcessTest

from "array" include Array
from "sys/process" include Process
from "wasi/process" include Process

// Just a smoke test
match (Process.argv()) {
Expand Down
@@ -1,6 +1,6 @@
module RandomTest

from "sys/random" include Random
from "wasi/random" include Random

// Just smoke tests, there's a miniscule chance these could fail

Expand Down
Expand Up @@ -2,7 +2,7 @@ module TimeTest

from "int64" include Int64
use Int64.{ (<), (<=) }
from "sys/time" include Time
from "wasi/time" include Time

let mt1 = Time.monotonicTime()
let mt2 = Time.monotonicTime()
Expand Down
10 changes: 5 additions & 5 deletions compiler/test/suites/stdlib.re
Expand Up @@ -66,7 +66,7 @@ describe("stdlib", ({test, testSkip}) => {
"stdlib_file_stdout",
{|
from "bytes" include Bytes
from "sys/file" include File
from "wasi/file" include File
ignore(File.fdWrite(File.stdout, Bytes.fromString("enterthe")))
print(void)
|},
Expand Down Expand Up @@ -104,10 +104,10 @@ describe("stdlib", ({test, testSkip}) => {
assertStdlib("stack.test");
assertStdlib("priorityqueue.test");
assertStdlib("string.test");
assertStdlib("sys.file.test");
assertStdlib(~code=5, "sys.process.test");
assertStdlib("sys.random.test");
assertStdlib("sys.time.test");
assertStdlib("wasi.file.test");
assertStdlib(~code=5, "wasi.process.test");
assertStdlib("wasi.random.test");
assertStdlib("wasi.time.test");
assertStdlib("wasmf32.test");
assertStdlib("wasmf64.test");
assertStdlib("wasmi32.test");
Expand Down
2 changes: 1 addition & 1 deletion compiler/test/suites/wasi_args.re
Expand Up @@ -8,7 +8,7 @@ describe("wasi args and env", ({test, testSkip}) => {
let assertRun = makeRunner(test_or_skip);

let print_wasi_info = {|
from "sys/process" include Process
from "wasi/process" include Process
from "array" include Array
from "string" include String

Expand Down
2 changes: 1 addition & 1 deletion stdlib/hash.gr
Expand Up @@ -39,7 +39,7 @@ from "runtime/numbers" include Numbers
use Numbers.{ coerceNumberToWasmI32 }
from "runtime/bigint" include Bigint as BI

from "sys/random" include Random
from "wasi/random" include Random
from "result" include Result

@unsafe
Expand Down
2 changes: 1 addition & 1 deletion stdlib/random.gr
Expand Up @@ -7,7 +7,7 @@
*/
module Random

from "sys/random" include Random as WasiRandom
from "wasi/random" include Random as WasiRandom
from "result" include Result
from "uint32" include Uint32
from "uint64" include Uint64
Expand Down
2 changes: 1 addition & 1 deletion stdlib/sys/file.gr → stdlib/wasi/file.gr
Expand Up @@ -3,7 +3,7 @@
*
* Many of the functions in this module are not intended to be used directly, but rather for other libraries to be built on top of them.
*
* @example from "sys/file" include File
* @example from "wasi/file" include File
*/
module File

Expand Down
2 changes: 1 addition & 1 deletion stdlib/sys/file.md → stdlib/wasi/file.md
Expand Up @@ -7,7 +7,7 @@ Utilities for accessing the filesystem & working with files.
Many of the functions in this module are not intended to be used directly, but rather for other libraries to be built on top of them.

```grain
from "sys/file" include File
from "wasi/file" include File
```

## Types
Expand Down
2 changes: 1 addition & 1 deletion stdlib/sys/process.gr → stdlib/wasi/process.gr
Expand Up @@ -3,7 +3,7 @@
*
* This includes things like accessing environment variables and sending signals.
*
* @example from "sys/process" include Sys/process
* @example from "wasi/process" include Process
*/
module Process

Expand Down
2 changes: 1 addition & 1 deletion stdlib/sys/process.md → stdlib/wasi/process.md
Expand Up @@ -7,7 +7,7 @@ Utilities for accessing functionality and information about the Grain program's
This includes things like accessing environment variables and sending signals.

```grain
from "sys/process" include Sys/process
from "wasi/process" include Process
```

## Types
Expand Down
2 changes: 1 addition & 1 deletion stdlib/sys/random.gr → stdlib/wasi/random.gr
@@ -1,7 +1,7 @@
/**
* System access to random values.
*
* @example from "sys/random" include Random
* @example from "wasi/random" include Random
*/
module Random

Expand Down
2 changes: 1 addition & 1 deletion stdlib/sys/random.md → stdlib/wasi/random.md
Expand Up @@ -5,7 +5,7 @@ title: Random
System access to random values.

```grain
from "sys/random" include Random
from "wasi/random" include Random
```

## Values
Expand Down
2 changes: 1 addition & 1 deletion stdlib/sys/time.gr → stdlib/wasi/time.gr
@@ -1,7 +1,7 @@
/**
* Access to system clocks.
*
* @example from "sys/time" include Time
* @example from "wasi/time" include Time
*/
module Time

Expand Down
2 changes: 1 addition & 1 deletion stdlib/sys/time.md → stdlib/wasi/time.md
Expand Up @@ -5,7 +5,7 @@ title: Time
Access to system clocks.

```grain
from "sys/time" include Time
from "wasi/time" include Time
```

## Values
Expand Down