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

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

问题描述

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

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.

在真实"代码中注意真实"使用 Comonad 的奖励积分.

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

推荐答案

这些链接可能会有所帮助:

These links may be helpful:

  1. 评估元胞自动机是共生的.特别是,每当您看到由许多小型但相似的计算拼凑而成的大型数据结构时,很有可能我们正在处理一个共同体".
  2. 序列、流和片段
  3. 日常生活中的共生体
  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天全站免登陆