An interesting feature of Haskell is that all functions take only one argument. Multi-argument functions are an illusion. Whenever a two-argument function is needed, Haskell instead defines a function that takes a single argument and returns another function. The returned function takes the second argument and returns a result. All multi-argument functions are extensions of this pattern. When doing the final computation, all the arguments that have been passed in are in scope thanks to function closures. Haskell thinly hides this behavior in its syntax. Closures enable Haskell to have multi-argument functions while technically only supporting single-argument functions.
March 2, 2015