-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #661 from HigherOrderCO/657-make-io-functions-retu…
…rn-result #657 Make IO functions return Result
- Loading branch information
Showing
7 changed files
with
87 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
(Main) = | ||
use path = "tests/golden_tests/io/load.txt" | ||
(HVM.load path @result match result { | ||
Result/ok: result.val; | ||
Result/err: result.val; | ||
}) | ||
with IO { | ||
ask file = (IO/FS/read_file path) | ||
(String/decode_utf8 file) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
(Main) = | ||
use path = "tests/golden_tests/io/load_fail.txt" | ||
(HVM.load path @result match result { | ||
Result/ok: result.val; | ||
Result/err: result.val; | ||
}) | ||
use path = "tests/golden_tests/io/missing_dir/load_fail.txt" | ||
with IO { | ||
ask file = (IO/FS/read_file path) | ||
(String/decode_utf8 file) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
(Main) = | ||
use path = "tests/golden_tests/io/store.txt" | ||
(HVM.store path "(Main) = 0" @result match result { | ||
Result/ok: result.val; | ||
Result/err: result.val; | ||
}) | ||
with IO { | ||
ask res = (IO/FS/write_file path (String/encode_utf8 "(Main) = 0")) | ||
res | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
(Main) = | ||
use path = "tests/golden_tests/io/missing_dir/store_fail.txt" | ||
(HVM.store path "(Main) = 0" @result match result { | ||
Result/ok: result.val; | ||
Result/err: result.val; | ||
}) | ||
with IO { | ||
ask res = (IO/FS/write_file path (String/encode_utf8 "(Main) = 0")) | ||
res | ||
} |