https://www.tweag.io/blog/2020-01-16-data-vs-control/
Data Functor和Control Functor是两个不同的概念,只是在Haskell中有所混淆。
这两者从定义上,可以通过线性函数来区别。
从功能上,Data Functor只能做值的容器,Control Functor表示的是一个值在被执行副作用时的中间状态。Data Functor可以是Applicative,Control Functor可以是Applicative和Monad.
从范畴论的角度来看,Control functors are the enriched functors of the category of linear functions, while data functors are the regular functors.
Haskell:Data Functor和Control Functor
最新推荐文章于 2023-08-06 01:43:23 发布