[Haskell-cafe] Currying: The Rationale

Albert Y. C. Lai trebla at vex.net
Wed May 23 12:40:35 EDT 2007


PR Stanley wrote:
> What is the rationale behind currying?

Given
     map :: (a->b) -> [a]->[b]
     take :: Int -> [a] -> [a]
I can write "map f . take 10" or "take 10 >>> map f".

Given
     tmap :: (a->b, [a]) -> [b]
     ttake :: (Int, [a]) -> [a]
I have to write "\x -> tmap(f, ttake(10, x))".

It is not just syntax. Syntax messes with your mind! The former invites 
you to see the pipeline architecture. The latter invites you to see the 
execution steps. The latter risks missing the forest for the trees.

The great value of the former is such that C++ STL <Functional> goes to 
great length to bring it back to C++.


More information about the Haskell-Cafe mailing list