Is it possible, or are there any plans to make it possible, to call a platform function from Roc that doesn't return an Effect? Like, being able to call some pure function in Rust to do some calculation?
the current plan is to never make this possible
it seems impossible in the general case to be able to verify that it's actually pure (doing it for wasm seems the most plausible, but even there it would need so many restrictions it's probably not worth the effort it would take because it would accept so few programs anyway) and if we can't be sure it's pure, we can't accept it
Somewhat related, I'm trying to diagnose a bug that's like 5 levels deep in a callstack. Is there any way I could throw in a log statement without having to convert all 5 functions to returning Task?
not yet, unfortunately :sweat_smile:
a way to do that is still on the TODO list!
logging for debugging is convenient, yeah, but if we're going that route, a builtin debugger would be nicer (conditionally compiled in, of course), such that a debug
function will set a breakpoint and enter an interactive, guided debugger if the environment supports it (stdin is a tty, or the editor wires up ipc), or logging variables and stack trace when the debugger cannot be used.
or alternatively the ability to capture sufficient platform inputs in the call chain to allow for a state file to be dumped and interactive tracing or "what if" exploration to happen after the fact, with the ability to record those explorations so that they can be revisited later, tried against updated code, etc
Being able to log to a debugger is a good idea. Sometimes in my work tho I need to log when I'm unable to attach a debugger (debugging multiple interactive processes working together, debugging a deployed/remote process)
oh yeah we definitely want the editor to have really nice debugging capabilities!
Last updated: Jul 06 2025 at 12:14 UTC