Applicative Functors
Learn how to use applicatives with the help of the examples in this lesson.
We'll cover the following...
Applicative functors
An applicative functor wraps a function. It can apply its function to another functor. For example:
Press + to interact
from oslash import Justfrom operator import nega = Just(3)f = Just(neg)b = f.apply(a)print(b)
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 ...
Access this course and 1400+ top-rated courses and projects.