Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions platform/Env.roc
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ exe_path! = |{}|
##
## If the value is invalid Unicode, the invalid parts will be replaced with the
## [Unicode replacement character](https://unicode.org/glossary/#replacement_character) ('�').
var! : Str => Result Str [VarNotFound]
var! : Str => Result Str [VarNotFound(Str)]
var! = |name|
Host.env_var!(name)
|> Result.map_err(|{}| VarNotFound)
|> Result.map_err(|{}| VarNotFound(name))

## Reads the given environment variable and attempts to decode it into the correct type.
## The type being decoded into will be determined by type inference. For example,
Expand All @@ -74,10 +74,10 @@ var! = |name|
## fail with [DecodeErr](https://www.roc-lang.org/builtins/Decode#DecodeError)
## because `123456789` is too large to fit in a [U16](https://www.roc-lang.org/builtins/Num#U16).
##
decode! : Str => Result val [VarNotFound, DecodeErr DecodeError] where val implements Decoding
decode! : Str => Result val [VarNotFound(Str), DecodeErr DecodeError] where val implements Decoding
decode! = |name|
when Host.env_var!(name) is
Err({}) -> Err(VarNotFound)
Err({}) -> Err(VarNotFound(name))
Ok(var_str) ->
Str.to_utf8(var_str)
|> Decode.from_bytes(EnvDecoding.format({}))
Expand Down
6 changes: 3 additions & 3 deletions platform/File.roc
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ is_writable! = |path_str|
## This uses [rust's std::fs::Metadata::accessed](https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.accessed).
## Note that this is [not guaranteed to be correct in all cases](https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.accessed).
##
## NOTE: thise function will not work if the platform was built with musl, which is the case for the normal tar.br URL release.
## NOTE: this function will not work on Linux if the platform was built with musl, which is the case for the normal tar.br URL release.
## See "Running Locally" in the README.md file to build without musl.
time_accessed! : Str => Result Utc [PathErr IOErr]
time_accessed! = |path_str|
Expand All @@ -263,7 +263,7 @@ time_accessed! = |path_str|
##
## This uses [rust's std::fs::Metadata::modified](https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.modified).
##
## NOTE: this function will not work if the platform was built with musl, which is the case for the normal tar.br URL release.
## NOTE: this function will not work on Linux if the platform was built with musl, which is the case for the normal tar.br URL release.
## See "Running Locally" in the README.md file to build without musl.
time_modified! : Str => Result Utc [PathErr IOErr]
time_modified! = |path_str|
Expand All @@ -275,7 +275,7 @@ time_modified! = |path_str|
##
## This uses [rust's std::fs::Metadata::created](https://doc.rust-lang.org/std/fs/struct.Metadata.html#method.created).
##
## NOTE: this function will not work if the platform was built with musl, which is the case for the normal tar.br URL release.
## NOTE: this function will not work on Linux if the platform was built with musl, which is the case for the normal tar.br URL release.
## See "Running Locally" in the README.md file to build without musl.
time_created! : Str => Result Utc [PathErr IOErr]
time_created! = |path_str|
Expand Down