is there a way to get a source location for various structures? For rbt especially, I'd like to say things like "the value you passed has such-and-such a characteristic, but that's not allowed!" along with the source location to fix things. Since rbt targets don't have human-usable names, the source location would be really nice!
as in get it at runtime in running Roc code?
Are you talking about getting compiler errors as JSON instead of text? I don't think we have that at the moment.
Or you could import the compiler into rbt as a Rust crate and run the parser and type checker.
I mean getting it at runtime! It doesn't seem like it's super possible, but I thought I'd ask.
I'm also gonna need to eventually get the path to the entrypoint file (and probably establish that there can only be one of those) to calculate paths relative to a root, so it's probably gonna be necessary to wrap the compiler in some way, even if it's only invoking the CLI.
Last updated: Jul 05 2025 at 12:14 UTC