There is a typeclass called Parallel
in Cats
. The purpose of this class is to provide parallel computations for some monads that don't support parallel computations out of the box like Either
for example.
I know that Monad
is used for dependent computations and thus requires sequential execution. Applicative
is used for independent computations, so such computations can be parallelized.
It's also known that each Monad
is Applicative
(monad is applicative functor).
So now I can't put together all concepts from the theory. If all monads are also applicatives, why I can't use applicative nature of monads for parallel computations and I need this Parallel
typeclass?
Is it just an option for Applicative
to support parallelism or it's a requirement?
来源:https://stackoverflow.com/questions/57166813/understanding-of-parallel-typeclass-from-cats