I've created an issue to track something that I have found confusing. Issue #4242. I get different error messages sometimes between roc dev and roc test. I'm not sure if my workflow is right, but I find I am running roc dev and roc test after each time I change my code.
Also found another related issue that crashed the formatter. Filed another issue #4343.
Please let me know if I'm raising issues that are helpful. Any feedback to improve my issues would be appreciated.
Your feedback and issues are very appreciated! I see nothing wrong with them :)
yeah, thank you! The more the better :smiley:
I was about to bring this up. Thanks @Luke Boswell :raised_hands: I was encountering the same confusing result. BTW, are we keeping track of unhelpful error messages? Something like what Elm does?
Several times already I've mistakenly used =
instead of ==
in the expect
function.
In roc test
:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: LoadingProblem(FormattedReport("\u{1b}[36m── ARGUMENTS BEFORE EQUALS ───────────────────────────────────────── mainA.roc ─\u{1b}[0m\n\nI am partway through parsing a definition, but I got stuck here:\n\n \u{1b}[36m1\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37mapp \"day-03A-2021\"\u{1b}[0m\n \u{1b}[36m2\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37m packages { pf: \"../../../../open-source-forks/roc/examples/cli/cli-platform/main.roc\" }\u{1b}[0m\n \u{1b}[36m3\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37m imports [Main.{ Bit, ReportLine, Report }, pf.Program.{ Program }]\u{1b}[0m\n \u{1b}[36m4\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37m provides [main] to pf\u{1b}[0m\n \u{1b}[36m5\u{1b}[0m\u{1b}[36m│\u{1b}[0m\n \u{1b}[36m6\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37mmain : Program\u{1b}[0m\n \u{1b}[36m7\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37mmain = Main.run getAnswer\u{1b}[0m\n \u{1b}[36m8\u{1b}[0m\u{1b}[36m│\u{1b}[0m\n \u{1b}[36m9\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37mgetAnswer : Report -> Nat\u{1b}[0m\n\u{1b}[36m10\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37mgetAnswer = \\report ->\u{1b}[0m\n\u{1b}[36m11\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37m reportLineAcc = List.walk report [] walkReport\u{1b}[0m\n\u{1b}[36m12\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37m {gamma, epsilon} = getRates reportLineAcc\u{1b}[0m\n\u{1b}[36m13\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37m (toDecimal gamma) * (toDecimal epsilon)\u{1b}[0m\n\u{1b}[36m14\u{1b}[0m\u{1b}[36m│\u{1b}[0m\n\u{1b}[36m15\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37mReportLineAcc : List (Dict Bit Nat)\u{1b}[0m\n\u{1b}[36m16\u{1b}[0m\u{1b}[36m│\u{1b}[0m\n\u{1b}[36m17\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37mwalkReport : ReportLineAcc, ReportLine -> ReportLineAcc\u{1b}[0m\n\u{1b}[36m18\u{1b}[0m\u{1b}[36m│\u{1b}[0m\n\u{1b}[36m19\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37mexpect walkReport [] [One, Zero, One, One, Zero] = [Dict.single One 1, Dict.single Zero 1, Dict.single One 1, Dict.single One 1, Dict.single Zero 1]\u{1b}[0m\n \u{1b}[31m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u{1b}[0m\n\nLooks like you are trying to define a function. In roc, functions are\nalways written as a lambda, like \u{1b}[33mincrement = \\n -> n + 1\u{1b}[0m."))', crates/cli/src/lib.rs:392:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
In roc dev
:
── ARGUMENTS BEFORE EQUALS ───────────────────────────────────────── mainA.roc ─
I am partway through parsing a definition, but I got stuck here:
1│ app "day-03A-2021"
2│ packages { pf: "../../../../open-source-forks/roc/examples/cli/cli-platform/main.roc" }
3│ imports [Main.{ Bit, ReportLine, Report }, pf.Program.{ Program }]
4│ provides [main] to pf
5│
6│ main : Program
7│ main = Main.run getAnswer
8│
9│ getAnswer : Report -> Nat
10│ getAnswer = \report ->
11│ reportLineAcc = List.walk report [] walkReport
12│ {gamma, epsilon} = getRates reportLineAcc
13│ (toDecimal gamma) * (toDecimal epsilon)
14│
15│ ReportLineAcc : List (Dict Bit Nat)
16│
17│ walkReport : ReportLineAcc, ReportLine -> ReportLineAcc
18│
19│ expect walkReport [] [One, Zero, One, One, Zero] = [Dict.single One 1, Dict.single Zero 1, Dict.single One 1, Dict.single One 1, Dict.single Zero 1]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Looks like you are trying to define a function. In roc, functions are
always written as a lambda, like increment = \n -> n + 1.%
we don't have a centralized place for confusing error messages at the moment, but definitely please open an issue on the repo any time you find one confusing!
I just saw that y'all have the error-messages
label in the GitHub Issues. That's a sufficient way of grouping these messages we want to improve. I created an issue, but someone will need to add the label to it.
done, thank you!
Last updated: Jul 05 2025 at 12:14 UTC