Stream: beginners

Topic: when is bug


view this post on Zulip Eli Dowling (Apr 29 2024 at 04:27):

isTwo = \bytes ->
    when bytes is
        ['\n', '\n', .. as rest] -> Bool.true
        [a, .. as rest] if a == 'h' -> isTwo rest
        [_, .. as rest] -> isTwo rest
        [] -> Bool.false
expect isTwo ['\n'] |> Bool.not

This code causes a compiler crash for me:

thread 'main' panicked at 'Expected symbol `17.IdentId(5)` to be in environment', crates/compiler/mono/src/inc_dec.rs:293:21

Thought I'd better put it here for those who come after me. It seems like it's an issue with having the if case and the case that destructures two items from the list

view this post on Zulip Jasper Woudenberg (Apr 29 2024 at 18:15):

I think that might be the same as this bug:
https://github.com/roc-lang/roc/issues/6606

view this post on Zulip Eli Dowling (Apr 29 2024 at 22:50):

Ahh, well spotted, that does look like it


Last updated: Jul 05 2025 at 12:14 UTC