Home

uncurried

Uncurried is a term used in functional programming to describe a function that accepts multiple arguments together as a single composite value (for example, a pair or tuple) rather than as a chain of single-argument functions produced by currying. Currying transforms a function f that takes two arguments into a new function that takes the first argument and returns a second function for the second argument. An uncurried version does not perform that separation and instead expects the combined input in one parameter.

In languages like Haskell, the distinction is common. A curried addition function might have the type Int

Some languages expose both forms explicitly. Scala, for example, offers Function2[A,B,R] with methods .curried and .uncurried;

Uncurried functions can be convenient when passing a binary operation to higher-order functions that expect a

->
Int
->
Int,
while
its
uncurried
form
has
type
(Int,
Int)
->
Int.
The
standard
library
provides
curry
and
uncurry
to
convert
between
the
forms:
curry
converts
a
function
on
a
pair
to
a
curried
function,
while
uncurry
converts
a
curried
function
to
an
uncurried
one.
Many
other
languages
provide
analogous
concepts.
Python
and
JavaScript
typically
use
uncurried
functions
by
default,
though
partial
application
can
simulate
currying.
single
argument,
or
when
you
want
to
apply
a
function
to
a
tuple
produced
elsewhere.
They
can
also
be
easier
to
instantiate
or
test
in
isolation,
but
they
lose
the
straightforward
partial
application
benefits
of
currying.