Rename Result.after to Result.try

This commit is contained in:
Richard Feldman 2022-07-17 17:25:12 -04:00
parent 31f7d72ce0
commit 0acab0eef3
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
5 changed files with 39 additions and 39 deletions

View file

@ -291,7 +291,7 @@ fn decode() {
fromBytes = \lst, fmt ->
when decodeWith lst decoder fmt is
{ result, rest } ->
Result.after result \val ->
Result.try result \val ->
if List.isEmpty rest
then Ok val
else Err (Leftover rest)

View file

@ -2479,9 +2479,9 @@ fn backpassing_result() {
main : I64
main =
helper =
x <- Result.after a
y <- Result.after (f x)
z <- Result.after (g y)
x <- Result.try a
y <- Result.try (f x)
z <- Result.try (g y)
Ok z
@ -3610,7 +3610,7 @@ fn lambda_capture_niches_have_captured_function_in_closure() {
g = \{ s1 } -> \_ -> s1
fun = \x ->
h =
h =
when x is
True -> after (\{} -> "") f
False -> after (\{} -> {s1: "s1"}) g

View file

@ -277,7 +277,7 @@ fn roc_result_after_on_ok() {
input : Result I64 Str
input = Ok 1
Result.after input \num ->
Result.try input \num ->
if num < 0 then Err "negative!" else Ok -num
"#),
RocResult::ok(-1),
@ -293,7 +293,7 @@ fn roc_result_after_on_err() {
input : Result I64 Str
input = (Err "already a string")
Result.after input \num ->
Result.try input \num ->
if num < 0 then Err "negative!" else Ok -num
"#),
RocResult::err(RocStr::from("already a string")),
@ -308,7 +308,7 @@ fn roc_result_after_err() {
r#"
result : Result Str I64
result =
Result.afterErr (Ok "already a string") \num ->
Result.tryErr (Ok "already a string") \num ->
if num < 0 then Ok "negative!" else Err -num
result
@ -321,7 +321,7 @@ fn roc_result_after_err() {
r#"
result : Result Str I64
result =
Result.afterErr (Err 100) \num ->
Result.tryErr (Err 100) \num ->
if num < 0 then Ok "negative!" else Err -num
result