too-many-lists icon indicating copy to clipboard operation
too-many-lists copied to clipboard

Adding `where` after `map`'s type

Open Arthur-Milchior opened this issue 2 years ago • 0 comments

On first read, I was extremely confused about this clarification. I could not understand how map was producing this U, while F had a type with no constraint at all. I had to look at map's documentation to figure out that actually F is constrained. To avoid this confusion for other reader, I think that adding this part of the definition is helpful.

While one can argue that it does not matter since the turbofish don't constrain F, I'd argue that as long as F is explicitly written down, it matters for the sake of clarity. Another solution would be to hide F from the type here and replace it by a symbol indicating that we can ignore it. But I believe that it would complexify things uselessly, since as far as I understand, it could not be done in valid Rust

Arthur-Milchior avatar May 18 '22 22:05 Arthur-Milchior