Currying transforms a morphism of two variables into a morphism taking values in an exponential object. The evaluation map of an exponential object recovers the original morphism. Its categorical universal property requires naturality and uniqueness, not just an underlying set bijection.
In functional programming, currying represents a function of several arguments as successive one-argument functions. In Haskell, arrows associate to the right: a -> b -> c means a -> (b -> c). Supplying an argument of type a therefore returns a function of type b -> c, while a function of type (a,b) -> c expects a tuple. Uncurrying converts the first representation to the second.
Convert a curried function into one taking a tuple: uncurry f (x,y) = f x y. Conversely, curry f x y = f (x,y). The two conversions undo each other on total arguments. Uncurrying lets map apply a curried binary operation to each tuple in a zipped list.

Articles by others on the same topic (0)

There are currently no matching articles.