Hey, I've managed to get roc repl + compiler to work on my Mac 12.6 Monterey, but roc test gets mad:
thread '<unnamed>' 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
I tried with/without the app
header. I'm following the Roc tutorial docs.
What does roc check
say? Do you have any type errors?
── MISSING DEFINITION ─────────────────────────────────────────────── main.roc ─
main is listed as exposed, but it isn't defined in this module.
You can fix this by adding a definition for main, or by removing it
from exposes.
── TYPE MISMATCH ──────────────────────────────────────────────────── main.roc ─
This 2nd argument to isEq has an unexpected type:
20│ if count == 1 then
^
The argument is a number of type:
Num *
But isEq needs its 2nd argument to be:
Num * | * has Eq
────────────────────────────────────────────────────────────────────────────────
2 errors and 1 warning found in 14 ms.
Yeah, currently we have some bugs if you try to compile a Roc program that has type errors. That type error is a bug; I'm working on fixing it now. In the meantime you can use a type annotation as a workaround (https://roc.zulipchat.com/#narrow/stream/231634-beginners/topic/Type.20mismatch.20in.20if-then-else.20tutorial.20example/near/313227546)
Currently roc test
does not exit early if there are type errors, which is why you saw the panic above, rather than a type error. We intend to change that soon.
No worries, ok. I tried: pluralize : Str, Str, Num * -> Str
and pluralize : Str, Str, Num -> Str
, but both seem... off. Do you know what that 3rd param should be?
try pluralize : Str, Str, Num a -> Str | a has Eq
Fascinating, same response:
── TYPE MISMATCH ──────────────────────────────────────────────────── main.roc ─
This 2nd argument to isEq has an unexpected type:
51│ if count == 1 then
^
The argument is a number of type:
Num *
But isEq needs its 2nd argument to be:
Num a | a has Eq
What if you say
one : Num a | a has Eq
one = 1
if count == one then ...
lol, here's what roc check
says:
── TYPE MISMATCH ──────────────────────────────────────────────────── main.roc ─
Something is off with the body of the one definition:
51│ one : Num a | a has Eq
52│ one = 1
^
The body is a number of type:
Num *
But the type annotation on one says it should be:
Num a | a has Eq
Oh man, I'm sorry. I have a fix here: https://github.com/roc-lang/roc/pull/4644 - if it lands today it'll be in tomorrow's nightly release.
Nooooo worries, it was fun to learn about the types!
Appreciate your help and patience here.
The fix for this should be in the nightly release available tomorrow
New nightly releases are published :)
Last updated: Jul 06 2025 at 12:14 UTC