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
── MISSING EXPRESSION in ./examples/DesugaringTry/main.roc ─────────────────────
I am partway through parsing a when expression, but I got stuck here:
21│ when Str.split_first(str, " was born in ") is
22│ Err(err1) -> return Err(err)
^
I was expecting to see an expression like 42 or "hello".
app [main!] { cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/bi5zubJ-_Hva9vxxPq4kNx4WHX6oFs8OP6Ad0tCYlrY.tar.br" }
import cli.Stdoutmain! = |_args|
Stdout.line!(Inspect.to_str(parse_name_and_year("Alicewas born in 1990")))? Stdout.line!(Inspect.to_str(parse_name_and_year_try("Alice was born in 1990")))? Ok({})### start snippet questionparse_name_and_year : Str -> Result { name : Str, birth_year : U16 } _parse_name_and_year = |str| { before: name, after: birth_year_str } = Str.split_first(str, " was born in ")? birth_year = Str.to_u16(birth_year_str)? Ok({ name, birth_year })### end snippet questionparse_name_and_year_try = |str| ### start snippet try when Str.split_first(str, " was born in ") is Err(err1) -> return Err(err) Ok({ before: name, after: birth_year_str }) -> when Str.to_u16(birth_year_str)? is Err(err2) -> return Err(err2) Ok(birth_year) -> Ok({ name, birth_year })### end snippet tryexpect parse_name_and_year("Alice was born in 1990") == Ok({ name: "Alice", birth_year: 1990 })expect parse_name_and_year_try("Alice was born in 1990") == Ok({ name: "Alice", birth_year: 1990 })
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: