Understanding of Parallel typeclass from Cats

倾然丶 夕夏残阳落幕 提交于 2020-01-02 16:53:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!