A case can be made that this has nothing to do with Monads in particular, in that first-class functions are reified computations. In that case, any given monad is just a special case of the use of first-class functions, due to the nature of bind. To see where I'm coming from here, consider the functions of the lambda calculus. In one sense, all of the functions of the lambda calculus are reified computations, since they are the significant part of the language and can be manipulated in any way you see fit. Functions are computations, and so functions that can be passed as arguments are reified computations.
An (higher-order) algebraic structure consisting of bind and return (or join and return) satisfying the monad laws
Out of these (including yours), I would claim that only the last three definitions tell us what a monad is: An algebraic structure. Everything else tells us what monads are used for, give a (bad to flawed) metaphor, say how a particular calculus expresses monads, or, like yours, elaborate what monads mean in a certain frame of reference (e.g. lambda calculus).
Viewing them as reification of computation/effects sounds like a mental model that is not inherently broken, but I would still advise to leave it behind and look at monads as an algebraic structure, devoid of any particular reference to the calculus one uses to express them: For the simple reason that doing that eases reasoning about the frame of reference one is trying to tame with a monad (say, a parser) without getting one's thoughts tangled up in, say, lambda calculus.
发布评论
评论(2)
以下链接可以说是支持您的主张的证据:
可以证明这与 Monad 无关,因为首先类函数是具体化的计算。在这种情况下,由于绑定的性质,任何给定的 monad 只是使用第一类函数的特殊情况。要了解我的出发点,请考虑 lambda 演算的函数。从某种意义上说,lambda 演算的所有函数都是具体化计算,因为它们是语言的重要部分,并且可以按照您认为合适的任何方式进行操作。函数是计算,因此可以作为参数传递的函数是具体化计算。
The following links can be said to be evidence towards your claim:
A case can be made that this has nothing to do with Monads in particular, in that first-class functions are reified computations. In that case, any given monad is just a special case of the use of first-class functions, due to the nature of bind. To see where I'm coming from here, consider the functions of the lambda calculus. In one sense, all of the functions of the lambda calculus are reified computations, since they are the significant part of the language and can be manipulated in any way you see fit. Functions are computations, and so functions that can be passed as arguments are reified computations.
是的,他们可以。此外,它们可以被视为(此列表非常不完整):
在这些(包括你的)中,我认为只有最后三个定义告诉我们什么是 monad:代数结构。其他一切都告诉我们 monad 的用途,给出一个(不好到有缺陷的)隐喻,说明特定的演算如何表达 monad,或者像您一样,详细说明 monad 在特定参考框架中的含义(例如 lambda 演算)。
将它们视为计算/效果的具体化,听起来像是一种本质上没有被破坏的心智模型,但我仍然建议将其抛在脑后,将单子视为一种代数结构,没有任何对用来表达它们的微积分的特定引用:原因很简单,这样做可以简化关于参考框架的推理,人们试图驯服单子(例如解析器),而不会让自己的思想陷入例如 lambda 演算中。
Yes, they can. Additionally, they can be seen as (this list is very incomplete):
Out of these (including yours), I would claim that only the last three definitions tell us what a monad is: An algebraic structure. Everything else tells us what monads are used for, give a (bad to flawed) metaphor, say how a particular calculus expresses monads, or, like yours, elaborate what monads mean in a certain frame of reference (e.g. lambda calculus).
Viewing them as reification of computation/effects sounds like a mental model that is not inherently broken, but I would still advise to leave it behind and look at monads as an algebraic structure, devoid of any particular reference to the calculus one uses to express them: For the simple reason that doing that eases reasoning about the frame of reference one is trying to tame with a monad (say, a parser) without getting one's thoughts tangled up in, say, lambda calculus.