Putting this in the repl crashes Roc and I'm not sure what is causing it.
» x = 10
… when x > 1 is
… Bool.true -> "Yes"
… Bool.false -> "No"
"x\xe0R\x06\x01"
thread 'main' panicked at 'Roc hit an error', crates/repl_cli/src/cli_gen.rs:129:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
and another
» x = 10
…
… check : Num -> Bool
… check = \x -> x > 10
…
… when check 10 is
… Bool.true -> "Yes"
… Bool.false -> "No"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Erroneous', crates/compiler/mono/src/ir.rs:10148:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
hm, what does roc version
say?
it looks like an old binary because x = 10
resulted in …
- which it doesn't do anymore :big_smile:
matching constants in when expressions is not currently supported - you would need to use an if here, or do something like "b if b -> "Yes"" instead of the "Bool.true -> "Yes"" branch
Last updated: Jul 05 2025 at 12:14 UTC