Using applicative functors
Applicative functors are a subset of functors with a few additional requirements imposed on them, thus making them a bit more useful. Similar to functors, applicative functors are computational contexts that are capable of applying a function to the value contained in them. The only difference is that the function to be applied to an applicative functor must itself be wrapped in the context of an applicative functor. Applicative functors also have a different interface of functions associated with them. An applicative functor, in cats, is manipulated using two functions: fapply and pure.
Note
The following examples can be found in src/m_clj/c6/ applicatives.clj of the book's source code.
The fapply function from the cats.core ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access