Why is `join` also known as `mu`?

时间:2016-08-30 04:43:42

标签: functional-programming monads idris

I noticed in the Idris documentation that join is also known as flatten and 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 (or μ) is used as a binder for recursive data types. I've not seen mu in this context before. What's the background on that?

1 个答案:

答案 0 :(得分:4)

答案非常简短:类别理论。

中长答案: 如果你看一下维基百科上的formal definition of a Monad(对不起,因为没有LaTeX支持,所以不要复制它),你会看到" mu"和" eta"用作两个" natural transformations",其中mu是从T2到T的那个(如果你看一下类型签名是有意义的,它从(m (m a)到{ {1}})。

深入回答:Monads Made Difficult(参见"自然变换")