What are all of the monad naming conventions?

后端 未结 1 1136
野的像风
野的像风 2021-02-19 07:16

It seems that Haskell has established several naming conventions around monads.

Examples:

  • appending T to the end to obtain the name of the mon
相关标签:
1条回答
  • 2021-02-19 08:16
    • runX m where m :: X a will run the X monad and return the "side effect" along with the monad result, a.

    • evalX m will run the computation and return the result, a.

    • execX m will run the computation and return the "side effect" but not the result.

    • The lifts come in various flavors that can be a bit too tricky for me to want to explain them in a SO answer. You should probably know lift and liftIO and be aware of / eventually seek out the other variants such as liftWith and liftBaseWith. See, for example, EZYang's posting on the topic.

    • appending a T after the monad name implies transformer. Appending an M after a function name implies it is monadic. Appending an _ implies the result is ignored.

    • All other suffixed letters mean "use hoogle".

    0 讨论(0)
提交回复
热议问题