Stream: bugs

Topic: Panic When Mapping -> Try function on List


view this post on Zulip Edwin Santos (Dec 11 2025 at 02:35):

Hi again :sweat_smile:

When trying to run the below:

app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.4/6XA8JLWhmG1FSgb8GxPjBs9cGrtRqopohR3KAHYo722z.tar.zst" }


import pf.Stdout

main! = |_args| {
    list_flats = ["2022", "22", "11", "ots"]
    _list_try = List.map(list_flats, U64.from_str)
    Ok({})
}

I'm getting the stack trace:

thread 2065897 panic: reached unreachable code
???:?:?: 0x1041cc0f3 in ??? (list_test.roc)
???:?:?: 0x1042be157 in ??? (list_test.roc)
???:?:?: 0x10437bce3 in ??? (list_test.roc)
???:?:?: 0x10423ed2f in ??? (list_test.roc)
???:?:?: 0x1041f0a7f in ??? (list_test.roc)
???:?:?: 0x1041c5fcf in ??? (list_test.roc)
???:?:?: 0x1041c37cf in ??? (list_test.roc)
???:?:?: 0x1041c3237 in ??? (list_test.roc)
???:?:?: 0x1041c319b in ??? (list_test.roc)
???:?:?: 0x181a1c273 in ??? (???)
???:?:?: 0x0 in ??? (???)

Roc check passes on this file without issue. The following code which applies the fallible function without creating a List does succeed:

main! = |_args| {
    list_flats = ["2022", "22", "11", "ots"]
    for elt in list_flats {
        int_elt = match U64.from_str(elt) {
            Ok(i) => U64.to_str(i)
            Err(_) => "Was not an int string"
        }
        Stdout.line!("Val ${int_elt}")
    }
    Ok({})
}

Let me know if I should create a GH issue for this.

view this post on Zulip Luke Boswell (Dec 11 2025 at 02:38):

Can you try with the latest platform release https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/tag/0.5

view this post on Zulip Luke Boswell (Dec 11 2025 at 02:38):

Also are you using roc built from source?

Would you mind sharing the result of roc version

view this post on Zulip Edwin Santos (Dec 11 2025 at 02:39):

On a potentially related note, the following code:

app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.3/98T93wthPgoBRLYtPTT4RBBsQunrfDG94gihPf1zYYmE.tar.zst" }

input_multi =
    \\R41
    \\R17
    \\L15
    \\L2
    \\L41
    \\L47
    \\L42

import pf.Stdout


main! = |_args| {
    input_list : List(Str)
    input_list = input_multi.split_on("\n")
    _a = input_list.take_first(10).for_each!(|elt| Stdout.line!("Row value ${elt}"))
    run_sample = input_list.take_first(10).map(parse_direction)
    _b = run_sample.take_first(10).for_each!(|r_elt| match r_elt {
        Ok(s) => Stdout.line!("Successful parse as ${s}")
        Err(e) => Stdout.line!("Parse failure: ${e}")
    })
}

parse_direction : Str -> Try(I64, _)
parse_direction = |string| {
    if string.starts_with("L") {
        parse_attempt = string.drop_prefix("L") -> I64.from_str
        parse = parse_attempt?
        Ok(parse *-1)
    } else if string.starts_with("R") {
        string.drop_prefix("R") -> I64.from_str
    } else {
        Err(RotationIsNotLR)
    }
}

Also fails on applying a fallible function to a List. This one gives a distinct stack trace:

thread 2072461 panic: trying to add var at rank 1, but current rank is 0
???:?:?: 0x10673d07b in _generalize.VarPool.addVarToRank (???)
???:?:?: 0x106747907 in _Check.unifyWithCtx (???)
???:?:?: 0x1065d476b in _Check.unifyFromAnno (???)
???:?:?: 0x1063c1e77 in _Check.checkPlatformRequirements (???)
???:?:?: 0x1063bf037 in _main.setupSharedMemoryWithModuleEnv (???)
???:?:?: 0x1063c51bb in _main.rocRun (???)
???:?:?: 0x10652bcc3 in _main.mainArgs (???)
???:?:?: 0x10652d1eb in _main.main (???)
???:?:?: 0x10652d723 in _main (???)
???:?:?: 0x181a1c273 in ??? (???)
???:?:?: 0x0 in ??? (???)
zsh: abort      roc run aoc_2025_01.roc

view this post on Zulip Edwin Santos (Dec 11 2025 at 02:39):

Luke Boswell said:

Also are you using roc built from source?

Would you mind sharing the result of roc version

Yeah I just pulled from upstream main a second ago, this is the roc version

Roc compiler version debug-b1fd9424

view this post on Zulip Richard Feldman (Dec 11 2025 at 02:40):

I'll take a look!

view this post on Zulip Luke Boswell (Dec 11 2025 at 02:40):

We've had some breaking changes since those older releases... I might delete them

view this post on Zulip Luke Boswell (Dec 11 2025 at 02:40):

I wish there was a way to "archive" a release in GH

view this post on Zulip Luke Boswell (Dec 11 2025 at 02:41):

Or maybe I should just leave them..

view this post on Zulip Richard Feldman (Dec 11 2025 at 02:43):

you can just delete them

view this post on Zulip Edwin Santos (Dec 11 2025 at 02:43):

I just reran the both examples with the following:

app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.5/BJBzo2SR2o5w3StmubGWvnPHq6hfePMaNWy5MwkPuZUs.tar.zst" }

from the platform release yesterday, each had their same panics as before.

view this post on Zulip Richard Feldman (Dec 11 2025 at 02:43):

anyone who was using them will have them cached locally anyway


Last updated: Dec 21 2025 at 12:15 UTC