I read in cats documentation about typeclasses Apply
and Applicative
. I wonder why the library provides two separate type classes instead of just one type class Applicative
, which would extend Functor
and add ap
? Does anybody use Apply
that is not Applicative
?
Applicative
provides the pure
method, which is a way to "get in". Otherwise, although you could convert F[A]
to F[B]
, either with A => B
(via map
) or F[A => B]
(via ap
), you don't have the capacity to put anything inside an F
. So you're limited to letting others do it for you.
The difference with Applicative
is that you can put things in, starting from nothing.
Since either can be useful ("you are empowered to put things into an F
" and "no, keep your hands off, and operate on what you're given"), Applicative
and Apply
are separate typeclasses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With