Hi, I'm new here I was just coming to check out how Roc handled integer types and was surprised to see that
main! = |_args| {
x = 127.I8
_ = x + 1.I8
Ok({})
}
resulted in a "Compiler crashed
RuntimeError: unreachable", while doing the same in a different function (
helper! = |_args| {
x = 127.I8
_ = x + 1.I8
}
main! = |_args| {
Ok({})
}
resulted in a much nicer error message:
![]()
Curiously enough this:
helper! = |_args| {
x = 127.I8
_ = x + 1.I8
Ok({})
}
main! = |_args| {
Ok({})
}
gives no error and simpy "(no output)"
This testing was done on the interactive demo on the roc-lang.org.
Welcome @Per Schrijver ! :wave:
It looks the interactive demo still runs on an older Roc version. The latest prints the following message for your first code example:
Roc application crashed with this message:
Integer addition overflowed
Which is a bit better, but still not ideal.
The second example prints:
── ✗ compile time crash ───────────────────────────────────────────────────── test.roc:3:9
This definition crashed during compile-time evaluation.
_ = x + 1.I8
^^^^^^^^
The crash happened with this message:
Integer addition overflowed
── 1 error and 0 warnings ─────────────────────────────────────────────────────── test.roc
I guess the difference is that the first code example compiled successfully then failed at runtime, so there wasn't much debug information left at this point, while the second code example was evaluated at compile time so it was able to show more details. I'm really not sure why one gets evaluated at compile time and the other doesn't.
As for the third example, it looks like adding Ok({}) makes the compiler decide to _not_ evaluate the function at compile time, and since the main! function doesn't do anything, nothing happened at runtime.
I'm sorry I can't help more!
Last updated: Oct 15 2026 at 17:56 UTC