roc format

This commit is contained in:
Richard Feldman 2022-09-19 20:07:23 -04:00
parent aa6d29fbb1
commit 3c12f79771
No known key found for this signature in database
GPG Key ID: F1F21AA5B1D9E43B
4 changed files with 4 additions and 9 deletions

View File

@ -19,11 +19,9 @@ cwd =
# ## to this directory.
# setCwd : Path -> Task {} [InvalidCwd]* [Env]*
# setCwd = InternalTask.fromEffect Effect.setCwd
# ## Gets the path to the currently-running executable.
# exePath : Task Path [ExePathUnavailable]* [Env]*
# exePath = InternalTask.fromEffect Effect.setCwd
## Reads the given environment variable.
##
## If the value is invalid Unicode, the invalid parts will be replaced with the
@ -60,7 +58,6 @@ var = \name ->
# decode = \var ->
# Effect.envVar var
# |> InternalTask.fromEffect
## Reads all the process's environment variables into a [Dict].
##
## If any key or value contains invalid Unicode, the [Unicode replacement character](https://unicode.org/glossary/#replacement_character)
@ -91,17 +88,15 @@ dict =
# walk = \state, walker ->
# Effect.envWalk state walker
# |> InternalTask.fromEffect
# 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
# strings. However, it's unclear whether anyone would use it. What would the use case be? Reporting
# an error that the provided command-line args weren't valid Unicode? Does that still happen these days?
# TODO need to figure out clear rules for how to convert from camelCase to SCREAMING_SNAKE_CASE.
# Note that all the env vars decoded in this way become effectively *required* vars, since if any
# of them are missing, decoding will fail. For this reason, it might make sense to use this to
# 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*] | val has Decoding
# decodeAll : Task val [] [EnvDecodingFailed Str]* [Env*] | val has Decoding

View File

@ -8,4 +8,4 @@ fromEffect : Effect U8 -> InternalProgram
fromEffect = @InternalProgram
toEffect : InternalProgram -> Effect U8
toEffect = \@InternalProgram effect -> effect
toEffect = \@InternalProgram effect -> effect

View File

@ -115,4 +115,4 @@ withEnv = \toTask ->
# ## A combination of [Program.withArgs] and [Env.decodeAll], with the output of [Env.decodeAll]
# ## being passed after the command-line arguments.
# decodedEnv : (List Str, Result env [EnvDecodingFailed Str]* -> Task U8 [] *) -> Program
# | env has Decode
# | env has Decode

View File

@ -48,4 +48,4 @@ mainTask =
_ -> "Uh oh, there was an error!"
Stderr.line msg
|> Program.exit 1
|> Program.exit 1