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

自闭症网瘾萝莉.ら 提交于 2019-12-12 08:49:05

问题


What are the origins of the syntax ">>=" and ">>" in Haskell Monads? I'm not looking for a explanation of how Monads work but instead why the language designers chose that syntax. 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?


回答1:


m >>= k suggests "feed the result of computation m to the function k"; m >> n suggests "run the m computation and then the n computation".



来源:https://stackoverflow.com/questions/23094009/why-is-bind-written-as-in-haskell-monads

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!