简体   繁体   English

为什么在Haskell Monads中将“bind”写为>> =?

[英]Why is “bind” written as >>= in Haskell Monads?

What are the origins of the syntax ">>=" and ">>" in Haskell Monads? Haskell Monads中语法“>> =”和“>>”的起源是什么? I'm not looking for a explanation of how Monads work but instead why the language designers chose that syntax. 我不是在寻找Monads如何工作的解释,而是为什么语言设计者选择了这种语法。 To me, ">>=" and ">>" seems kind of arbitrary and never made intuitive sense. 对我而言,“>> =”和“>>”似乎有点武断,从未有过直觉。 Does anyone have a intuitive explanation? 有没有人有直观的解释? Is it syntax that comes from category theory? 这是来自类别理论的语法吗?

m >>= k suggests "feed the result of computation m to the function k "; m >>= k表示“将计算结果m馈送到函数k ”; m >> n suggests "run the m computation and then the n computation". m >> n建议“运行m计算,然后运行n计算”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM