Hi all, I keep getting crashes when I try the following:
myFn = \a, b -> List.findFirst b \c -> a == c
I’ve tried several versions of shifting things around and get crashes on different parts of the IR depending on how I move things around
Hi @Lukas Hermann,
The function you posted works for me, can you provide a complete file?
That’s the complete file. I was using it in the REPL
Here’s the error
panicked at crates/compiler/mono/src/ir.rs:6143:56:
called `Option::unwrap()` on a `None` value
Stack:
@https://www.roc-lang.org/repl/roc_repl_wasm.js:314:30
.wasm-function[console_error_panic_hook::hook::hafcd8d8439480be9]@[wasm code]
.wasm-function[std::panicking::rust_panic_with_hook::h3aa054d35a0817d7]@[wasm code]
.wasm-function[std::panicking::begin_panic_handler::{{closure}}::h2f73e4cf6cd6319a]@[wasm code]
.wasm-function[std::sys_common::backtrace::__rust_end_short_backtrace::h98ac61a6abbff7e9]@[wasm code]
.wasm-function[rust_begin_unwind]@[wasm code]
.wasm-function[core::panicking::panic_fmt::h3e1dd3d08288569e]@[wasm code]
.wasm-function[core::panicking::panic::h0f0c05b20da93dd7]@[wasm code]
.wasm-function[roc_mono::ir::late_resolve_ability_specialization::h13ebb7eb6c7a22cc]@[wasm code]
.wasm-function[roc_mono::ir::with_hole::h1ff2e7cadd72856c]@[wasm code]
.wasm-function[roc_mono::ir::from_can::h4d716e4b685b56cc]@[wasm code]
.wasm-function[roc_mono::ir::specialize_variable::h2bb45dd1dab34b88]@[wasm code]
.wasm-function[roc_mono::ir::Procs::insert_anonymous::h1fd4366abab0873b]@[wasm code]
.wasm-function[roc_mono::ir::with_hole::h1ff2e7cadd72856c]@[wasm code]
.wasm-function[roc_mono::ir::assign_to_symbol::h3d337254f70783c6]@[wasm code]
.wasm-function[roc_mono::ir::assign_to_symbols::h0b30ffd5f4767395]@[wasm code]
.wasm-function[roc_mono::ir::call_by_name::hfc0d741a6ca2d2e0]@[wasm code]
.wasm-function[roc_mono::ir::with_hole::h1ff2e7cadd72856c]@[wasm code]
.wasm-function[roc_mono::ir::from_can::h4d716e4b685b56cc]@[wasm code]
.wasm-function[roc_mono::ir::specialize_variable::h2bb45dd1dab34b88]@[wasm code]
.wasm-function[roc_mono::ir::Procs::insert_passed_by_name::hd85afd7204a1bab8]@[wasm code]
.wasm-function[roc_mono::ir::specialize_symbol::hdb034c60423d7bca]@[wasm code]
.wasm-function[roc_mono::ir::specialize_naked_symbol::hb70ac49f9c7ea194]@[wasm code]
.wasm-function[roc_mono::ir::with_hole::h1ff2e7cadd72856c]@[wasm code]
.wasm-function[roc_mono::ir::from_can::h4d716e4b685b56cc]@[wasm code]
.wasm-function[roc_mono::ir::from_can_let::ha65ec2492ba63baa]@[wasm code]
.wasm-function[roc_mono::ir::from_can::h4d716e4b685b56cc]@[wasm code]
.wasm-function[roc_mono::ir::specialize_variable::h2bb45dd1dab34b88]@[wasm code]
.wasm-function[roc_mono::ir::specialize_external_help::hc7a151699d69203d]@[wasm code]
.wasm-function[roc_load_internal::file::run_task::h09e57452f2edc9ff]@[wasm code]
.wasm-function[roc_load_internal::file::load_single_threaded::hb01f5629f33d0f86]@[wasm code]
.wasm-function[roc_repl_eval::gen::compile_to_mono::h9a7ba8e558c1169a]@[wasm code]
.wasm-function[wasm_bindgen_futures::future_to_promise::{{closure}}::{{closure}}::h04ee031b208052e6]@[wasm code]
.wasm-function[wasm_bindgen_futures::queue::Queue::new::{{closure}}::he1fa905bc22f28f4]@[wasm code]
.wasm-function[wasm_bindgen::convert::closures::invoke1_mut::hae9cb56680cefeec]@[wasm code]
__wbg_adapter_12@https://www.roc-lang.org/repl/roc_repl_wasm.js:205:73
real@https://www.roc-lang.org/repl/roc_repl_wasm.js:190:21
Ok, thanks for the clarification. I was able to reproduce the issue in the repl, I'll make an issue.
This is a possible workaround:
» myFn = \a, b -> List.findFirst b \c -> a == c
…
… myFn 3 [1,2,3]
Thanks!
btw when using the local repl you can force the creation of a newline without "submitting" the input with Ctrl+V followed by Ctrl+J. The web repl accepts shift+enter instead.
Last updated: Jul 05 2025 at 12:14 UTC