List [One, Two] -> List [One]
The function is only allowed to return One-Tags but it is returning a Two-Tag without any compiler errors: https://github.com/ni-ko-o-kin/advent-of-code-2022-roc/blob/e176fa9804d9ba598f8c4a55b2ca2adc258b0e83/OneTwo.roc#L24
Ouch, yeah that's a bug. Could you please file an issue?
Sure!
But is this function possible in roc? Does the compiler know that I only returned One-Tags in all when-is branches? (regardless of the compiler bug)
Well, that function is currently inferred as List [One, Two] -> List [One, Two]
(the bug is that the output tag is allowed to grow larger than you specified)
If both of your when branches were -> One
then List [One, Two] -> List [One]
would be inferred.
Last updated: Jul 05 2025 at 12:14 UTC