Note: this post assumes you already have some familiarity with
applicative functors

In this post, I'll show how to implement applicative functors in JavaScript,
specifically for options, and then show an alternative formulation that's
arguably better suited to languages that generally have uncurried functions
(that is, languages that tend to have functions that accept multiple arguments
rather than a single argument).

First of all, let's implement the option type (otherwise known as the maybe
type) in JavaScript as a functor:

Note that the use of the functor required us to curry the add
function. This isn't a problem in functional languages such as Haskell, since
functions tend to be curried by default. However, in languages that usually
define functions to have multiple arguments (uncurried languages, for short), such as JavaScript, things
get a little untidy.

My understanding of applicative functors is that they allow functors, or
rather map, to be generalised to functions that accept more than
one argument, such as add. Therefore, in an uncurried language,
we might imagine the following cleaner API:

Interestingly, the implementation of applyFunctorUncurried is most
easily expressed in terms of the original applyFunctor. I've found
cases like this explain why functional languages tend to favour curried
functions: it often makes the implementation of higher-order functions
such as applyFunctor much more straightforward.

This raises an interesting question: are these two formulations of
applyFunctor of equal power? That is, is it possible to implement
each in terms of the other? It's straightforward to see that we can implement
applyFunctorUncurried in terms of applyFunctor since
it's precisely the implementation above. What about implementing applyFunctor
in terms of applyFunctorUncurried? This turns out to be
pretty straightforward too:

Please let me know if you spot mistakes in any of the above -- I've not
exactly been rigorous in proof!

I'd be curious to know if there are any languages that include the
alternative formulation of applyFunctor, and whether there are
common cases where the original formulation is preferable even in uncurried
languages.