Are monad laws enforced in Haskell?

前端 未结 2 616
陌清茗
陌清茗 2021-02-18 18:45

From the Haskell wiki:

Monads can be viewed as a standard programming interface to various data or control structures, which is captured by the Monad cl

2条回答
  •  感动是毒
    2021-02-18 19:11

    No, the monad laws are not enforced by the language. But if you don't adhere to them, your code may not necessarily behave as you'd expect in some situations. And it would certainly be confusing to users of your code.

提交回复
热议问题