Applicative Functors
Explore the concept of applicative functors in functional programming. Learn how these functors wrap functions and apply them to other functors, including techniques for handling functions with multiple arguments using partial application. This lesson clarifies the use of applicative functors and their relation to functors and currying.
We'll cover the following...
We'll cover the following...
Applicative functors
An applicative functor wraps a function. It can apply its function to another functor. For example:
The first thing to know is that this code only works because Just isn’t only a functor, it is also an applicative functor. An ordinary functor doesn’t have an apply method. So, having wrapped our neg function in the applicative functor, f, we can apply it ...