Haskell中的Comonad类型类是什么? [英] What is the Comonad typeclass in Haskell?

查看:122
本文介绍了Haskell中的Comonad类型类是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Haskell中的Comonad类型类是什么?正如来自 Control.Comonad中的Comonad comonad软件包(对提供Comonad类型的任何其他软件包的解释也是受欢迎的)。我隐约听说过Comonad,但我真正知道的是,它提供了 extract :: w a - > a ,类似于Monad的 return :: a - >



在真实代码中注明Comonad的真实生活用途的奖励点。
<这些链接可能会有所帮助:


  1. 评估元胞自动机是comonadic 。特别是,无论何时你看到大量的数据结构都是由大量小而相似的计算拼凑而成的,我们很可能会处理一个comonad。
  2. //conal.net/blog/posts/sequences-streams-and-segmentsrel =noreferrer>序列,流和片段
  3. 日常生活中的同伴

>

What is the Comonad typeclass in Haskell? As in Comonad from Control.Comonad in the comonad package (explanations of any other packages that provide a Comonad typeclass are also welcome). I've vaguely heard about Comonad, but all I really know about it is that is provides extract :: w a -> a, sort of a parallel to Monad's return :: a -> m a.

Bonus points for noting "real life" uses of Comonad in "real" code.

解决方案

These links may be helpful:

  1. Evaluating cellular automata is comonadic. In particular, "whenever you see large datastructures pieced together from lots of small but similar computations there's a good chance that we're dealing with a comonad".
  2. Sequences, streams, and segments
  3. Comonads in everyday life

这篇关于Haskell中的Comonad类型类是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆