I have this line of code:
map (\(u,v) -> flatTorus n u v) gridUV
Hlint suggests me to replace it with
map (uncurry (flatTorus n)) gridUV
What is the motivation of this suggestion ? Is it for shortness only, or something else (performance) ? Because though it is longer, I find the first code more easy to read.
In fact my question is more general,, because this is just an example among others: does Hlint suggestions are generally based on a shortness motivation only or are there other improvements behind the suggestions ?
I think Hlint prefers using
uncurrybecause it gives you an invariant representation of the callback. Lambda expressions are inherently sensitive to representation, sinceis equivalent to
even though they are textually different.
Using
uncurryfrees readers of the cognitive load of doing alpha equivalence in their head (e.g., recognizing that the above two expressions are the same), but then saddles them with the cognitive load of having to remember a vocabulary of combinators. Ultimately, it's a matter of taste.