I can't get dbg to work at all. Is this a me thing? Something about the CLI platform? In some cases adding a dbg will make the program hang, but in this simple case it just returns and doesn't print.
app "dbg"
packages {
cli: "https://github.com/roc-lang/basic-cli/releases/download/0.5.0/Cufzl36_SnJ4QbOoEmiJ5dIpUxBvdB3NEySvuH82Wio.tar.br",
}
imports [
cli.Task,
]
provides [main] to cli
main =
dbg "foo"
Task.ok {}
I wonder if it makes a difference between roc run
or roc dev
? Not in front of my laptop rn so can't check myself
Yeah, that is it -- you need to use roc dev
Yes! That did it. It seems like this part of the tutorial out of date?
Note: dbg is a debugging tool, and is only available when running your program via a roc subcommand (for example using roc dev, roc run, or roc test). When you build a standalone application with roc build, any uses of dbg won't be included!
I recall a discussion some time ago about the intended functionality around dbg and those commands. I might try and find that before making a PR.
:+1: related to that, I'm able to dbg a string but not a list of structs. Is that an intentional limitation?
I think the plan is for everything to have the Inspect
ability, it looks like it is already in the builtins Inspect.roc, but I think it is still a WIP in implementation #5775 looks like the relevant PR.
So I think the plan is for dbg
to just use this instead of what it currently does which is more error prone.
See https://roc.zulipchat.com/#narrow/stream/395097-compiler-development/topic/Inspect.20as.20builtin/near/383933352 for more discussion
Last updated: Jul 06 2025 at 12:14 UTC