Hey ya'll, I am trying to port some old code to the zig compiler, but I am running into a strange issue where running roc test tells me that a List of type List(U8) does not match the expected argument of a function which requires List(a). Note that roc check does not complain.
Here is my best minimization of the issue:
Min :: [].{
func : List(a), (a -> Bool) -> List(List(a))
func = |list, _f| {
{ acc: [], current: list }
->(|{ acc, current }| {
if !List.is_empty(current)
acc.append(current)
else
acc
})
}
}
expect {
list : List(U8)
list = []
res = func(list, |x| x == 0)
res == []
}
-- TYPE MISMATCH ---------------------------------
The first argument being passed to this function has the wrong type:
┌─ /Users/imclerran/source/roc/playground/Min.roc:17:11
│
17 │ res = func(list, |x| x == 0)
│ ^^^^
This argument has the type:
List(U8)
But Min.func needs the first argument to be:
List(a)
Ran 1 tests in 6.3ms:
0 passed
1 failed
FAIL: Min.roc
14 │ expect {
15 │ list : List(U8)
16 │ list = []
17 │ res = func(list, |x| x == 0)
18 │ res == []
19 │ } - hit a runtime error
I'll check this out
Fixed in PR#9368
Last updated: May 01 2026 at 12:45 UTC