so I wrote some weird code which I tend to believe isn't sound to begin with, something along these lines
test = \x ->
if x == 0 then
Stdout.line "done"
else
_ <- Stdout.line "going down" |> Task.await
test (x-1)
main = test 6
so my questions are firstly should this theoretically work?
if so then what is the correct form to represent it (bear in mind it has to be recursive for the actual code)
and lastly the error that comes out of it is odd. it's like a big ast dump
thread 'main' panicked at 'internal error: entered unreachable code: symbol/layout `17.IdentId(48)` ProcLayout {
arguments: [
Struct {
hash: FieldOrderHash(
0,
# like a 1000 more lines of this
theoretically I'd expect this to work!
damn i kinda hoped not (so that there'd be an obvious way to make it work) lol
I thought I fixed this a couple weeks ago. Could you cut a minimal reproduction and file an issue please?
sure, be up in a couple minutes
up
Ayaz Hafiz said:
I thought I fixed this a couple weeks ago. Could you cut a minimal reproduction and file an issue please?
do you know where this panic originates? i would be interested in reading the source on this
Sure, the exact source of the panic is here: https://github.com/roc-lang/roc/blob/e1719b6fe28d8ceff61ca9ef45d68d012087987e/crates/compiler/mono/src/borrow.rs#L196-L199
However that will not really help much. The problem is that the compiler is looking for a specific specialization of the task function (Roc monomorphizes all user code) that wasn't actually produced. The process of specialization happens in this massive file. The reasons why this might happen are varying and historically aren't for any one particular reason.
im gonna need some more braincells for this
thanks
If you want, feel free to DM me and we can talk through some of it
Last updated: Jul 05 2025 at 12:14 UTC