You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To promote Roc developers providing context for Results when propagating errors with try, we want to add a new operator ? that acts as a Result.mapErr equivalent. Some example usages:
It should be higher precedence than try such that try will propagate errors after ? is applied, but it does not need to be used with try.
We should always attempt to format onto the same line as the fallible code, but can optionally wrap to a newline with an indentation to imply continuation; this prevents code from reading like we apply ? after try.
The new ? operator should be able to handle mapping over errors using pure or effectful mappers, meaning it should be its own AST node. We can start with a pure-only implementation, since we are waiting on purity inference still.
If a pure handler is used with the new ?? "Result.withDefault" operator, we should raise a warning that the error mapping is unnecessary, since it will always be discarded by ??.
The text was updated successfully, but these errors were encountered:
To promote Roc developers providing context for Results when propagating errors with
try
, we want to add a new operator ? that acts as aResult.mapErr
equivalent. Some example usages:It should be higher precedence than
try
such thattry
will propagate errors after ? is applied, but it does not need to be used withtry
.We should always attempt to format onto the same line as the fallible code, but can optionally wrap to a newline with an indentation to imply continuation; this prevents code from reading like we apply ? after
try
.The new ? operator should be able to handle mapping over errors using pure or effectful mappers, meaning it should be its own AST node. We can start with a pure-only implementation, since we are waiting on purity inference still.
If a pure handler is used with the new ?? "Result.withDefault" operator, we should raise a warning that the error mapping is unnecessary, since it will always be discarded by ??.
The text was updated successfully, but these errors were encountered: