I'm looking at https://www.roc-lang.org/builtins/List#mapWithIndex
I know what this does and most likely can figure out how to use it.
But I find that the function signature in the doc quite confusing
mapWithIndex : List a, a, Nat -> b -> List b
Looks like a function that takes three arguments
List a
a
Nat -> b
Which is not the case, maybe missing some parens?
Is this auto generated?
The correct type signature is mapWithIndex : List a, (a, Nat -> b) -> List b
.
Thanks for bringing this to our attention @Sebastian Porto, I'll make an issue for it.
I think we already have an issue for docs generation getting parens wrong
and yeah @Sebastian Porto the docs are auto generated - in this case, incorrectly :sweat_smile:
Ah, okay. I had thought there was just a clever right-associativity thing we were using, until I realized that most of those doc signatures are ambiguous.
I'm glad to find out it's just a doc bug. Even if it were unambiguous, I think the parens help with readability anyways.
Last updated: Jul 06 2025 at 12:14 UTC