Stream: beginners

Topic: Unable to dbg


view this post on Zulip Elias Mulhall (Oct 03 2023 at 03:39):

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 {}

view this post on Zulip Luke Boswell (Oct 03 2023 at 04:02):

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

view this post on Zulip Luke Boswell (Oct 03 2023 at 04:15):

Yeah, that is it -- you need to use roc dev

view this post on Zulip Elias Mulhall (Oct 03 2023 at 04:19):

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!

view this post on Zulip Luke Boswell (Oct 03 2023 at 04:21):

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.

view this post on Zulip Elias Mulhall (Oct 03 2023 at 04:22):

:+1: related to that, I'm able to dbg a string but not a list of structs. Is that an intentional limitation?

view this post on Zulip Luke Boswell (Oct 03 2023 at 04:28):

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.

view this post on Zulip Luke Boswell (Oct 03 2023 at 04:29):

So I think the plan is for dbg to just use this instead of what it currently does which is more error prone.

view this post on Zulip Luke Boswell (Oct 03 2023 at 04:34):

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