2 ms·
The problem is that currying is useful for so many things that this is a bit like asking 'what is addition useful for?' Currying can always be implemented just
by NickPollard 13y ago
The problem is that currying is useful for so many things that this is a bit like asking 'what is addition useful for?'
Currying can always be implemented just by lambdas, so it does not actually enable any new behaviour, but it makes a lot of things simpler - any time you want to close over values, it can normally be neatened by using currying.
Let's say you're making a 3D renderer. You have a list of vertices (points) in object space, and you want to transform them to screenspace by multiplying by a modelview matrix and then a projection matrix.
Without currying:
vectors fmap (\x -> multiply modelview x ) fmap (\x -> multiply projection x)
With currying:
vectors fmap (multiply modelview) fmap (multiply projection)