为什么 `join` 也被称为 `mu`?
Why is `join` also known as `mu`?
我在 Idris 文档中注意到 join
也称为 flatten
和 mu
。
Idris> :doc join
Prelude.Monad.join : Monad m => m (m a) -> m a
Also called flatten or mu
The function is Total
IIRC,mu
(或μ)用作递归数据类型的绑定器。我以前从未在这种情况下见过 mu
。其背景是什么?
非常简短的答案:范畴论。
中等长度的答案:
如果您查看 formal definition of a Monad on Wikipedia (sorry, not copying it over since there is no LaTeX support on SO), you'll see "mu" and "eta" used as the two "natural transformations",其中 mu 是从 T2 到 T 的那个(如果您查看从 (m (m a)
到 m a
的类型签名,这就有意义了)。
深入解答:Monads Made Difficult(见"Natural Transformations")
我在 Idris 文档中注意到 join
也称为 flatten
和 mu
。
Idris> :doc join
Prelude.Monad.join : Monad m => m (m a) -> m a
Also called flatten or mu
The function is Total
IIRC,mu
(或μ)用作递归数据类型的绑定器。我以前从未在这种情况下见过 mu
。其背景是什么?
非常简短的答案:范畴论。
中等长度的答案:
如果您查看 formal definition of a Monad on Wikipedia (sorry, not copying it over since there is no LaTeX support on SO), you'll see "mu" and "eta" used as the two "natural transformations",其中 mu 是从 T2 到 T 的那个(如果您查看从 (m (m a)
到 m a
的类型签名,这就有意义了)。
深入解答:Monads Made Difficult(见"Natural Transformations")