A few weeks ago this code would build successfully with the zig compiler. However I just build the latest main, and now I get an error message when building the following code. Not sure if My type annotation is incorrect, or if this is a compiler bug, so posting it up here.
keep_oks : List(a), (a -> Try(b, e)) -> List(b)
keep_oks = |vs, f| {
vs.fold(
[],
|acc, v| {
match f(v) {
Ok(u) => acc.append(u)
Err(_) => acc
}
},
)
}
Produces the following error:
The first argument being passed to this function has the wrong type:
┌─ main.roc:29:2
│
29 │ s.split_on("\n")
30 │ .map(extract_digits)
This argument has the type:
List(List(U64))
But keep_oks needs the first argument to be:
List(a)
Found 1 error(s) and 0 warning(s) for main.roc.
However, if I comment out the type annotation for keep_oks, it builds just fine.
Full code here: https://pastebin.com/Qn4xnhUY
@Ian McLerran would you mind opening a GH issue for this?
Sure thing!
Issue at #9018
Last updated: Feb 20 2026 at 12:27 UTC