Skip to content

Commit

Permalink
Merge pull request #301 from roc-lang/no-task-refs
Browse files Browse the repository at this point in the history
remove references to Task
  • Loading branch information
bhansconnect authored Jan 2, 2025
2 parents 71a0666 + 032712e commit b427a77
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
15 changes: 7 additions & 8 deletions platform/Env.roc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var! = \name ->
## Reads the given environment variable and attempts to decode it.
##
## The type being decoded into will be determined by type inference. For example,
## if this ends up being used like a `Task U16 _` then the environment variable
## if this ends up being used like a `Result U16 _` then the environment variable
## will be decoded as a string representation of a `U16`. Trying to decode into
## any other type will fail with a `DecodeErr`.
##
Expand All @@ -65,8 +65,8 @@ var! = \name ->
##
## ```
## # Reads "NUM_THINGS" and decodes into a U16
## getU16Var : Str -> Task U16 [VarNotFound, DecodeErr DecodeError] [Read [Env]]
## getU16Var = \var -> Env.decode! var
## get_u16_var! : Str => Result U16 [VarNotFound, DecodeErr DecodeError] [Read [Env]]
## get_u16_var! = \var -> Env.decode! var
## ```
##
## If `NUM_THINGS=123` then `getU16Var` succeeds with the value of `123u16`.
Expand Down Expand Up @@ -108,10 +108,9 @@ dict! = \{} ->
# ##
# ## If any key or value contains invalid Unicode, the [Unicode replacement character](https://unicode.org/glossary/#replacement_character)
# ## (`�`) will be used in place of any parts of keys or values that are invalid Unicode.
# walk : state, (state, Str, Str -> state) -> Task state [NonUnicodeEnv state] [Read [Env]]
# walk = \state, walker ->
# Effect.envWalk state walker
# |> InternalTask.fromEffect
# walk! : state, (state, Str, Str -> state) => Result state [NonUnicodeEnv state] [Read [Env]]
# walk! = \state, walker ->
# Host.env_walk! state walker
# TODO could potentially offer something like walkNonUnicode which takes (state, Result Str Str, Result Str Str) so it
# tells you when there's invalid Unicode. This is both faster than (and would give you more accurate info than)
# using regular `walk` and searching for the presence of the replacement character in the resulting
Expand All @@ -123,7 +122,7 @@ dict! = \{} ->
# decode all the required vars only, and then decode the optional ones separately some other way.
# Alternatively, it could make sense to have some sort of tag union convention here, e.g.
# if decoding into a tag union of [Present val, Missing], then it knows what to do.
# decodeAll : Task val [] [EnvDecodingFailed Str] [Env] where val implements Decoding
# decode_all : Result val [] [EnvDecodingFailed Str] [Env] where val implements Decoding

ARCH : [X86, X64, ARM, AARCH64, OTHER Str]
OS : [LINUX, MACOS, WINDOWS, OTHER Str]
Expand Down
12 changes: 6 additions & 6 deletions platform/Path.roc
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ display = \path ->
Err _ -> ""

## Returns true if the path exists on disk and is pointing at a directory.
## Returns `Task.ok false` if the path exists and it is not a directory. If the path does not exist,
## this function will return `Task.err PathErr PathDoesNotExist`.
## Returns `Ok false` if the path exists and it is not a directory. If the path does not exist,
## this function will return `Err (PathErr PathDoesNotExist)`.
##
## This uses [rust's std::path::is_dir](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_dir).
##
Expand All @@ -186,8 +186,8 @@ is_dir! = \path ->
Ok (res == IsDir)

## Returns true if the path exists on disk and is pointing at a regular file.
## Returns `Task.ok false` if the path exists and it is not a file. If the path does not exist,
## this function will return `Task.err PathErr PathDoesNotExist`.
## Returns `Ok false` if the path exists and it is not a file. If the path does not exist,
## this function will return `Err (PathErr PathDoesNotExist)`.
##
## This uses [rust's std::path::is_file](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_file).
##
Expand All @@ -198,8 +198,8 @@ is_file! = \path ->
Ok (res == IsFile)

## Returns true if the path exists on disk and is pointing at a symbolic link.
## Returns `Task.ok false` if the path exists and it is not a symbolic link. If the path does not exist,
## this function will return `Task.err PathErr PathDoesNotExist`.
## Returns `Ok false` if the path exists and it is not a symbolic link. If the path does not exist,
## this function will return `Err (PathErr PathDoesNotExist)`.
##
## This uses [rust's std::path::is_symlink](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_symlink).
##
Expand Down
2 changes: 1 addition & 1 deletion platform/Tcp.roc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ parse_connect_err = \err ->
"ErrorKind::Unsupported" -> Unsupported
other -> Unrecognized other

## Represents errors that can occur when performing a [Task] with a [Stream].
## Represents errors that can occur when performing an effect with a [Stream].
StreamErr : [
StreamNotFound,
PermissionDenied,
Expand Down

0 comments on commit b427a77

Please sign in to comment.