Snippets tagged counterexample

  • A bind/return computation expression that does not satisfy any of the monad laws

    A long overdue counterexample of a pure bind/return computation expression that does not satisfy any of the monad laws, as promised to @silverSpoon. This uses binary trees under the hood, which define a binary operation but do not satisfy any unit or associativity laws. Binary trees can also encode the syntactic structure of a computation expression, which is being captured using a state-updating bind implementation.

    3 people like this

    Posted: 2 years ago by Eirik Tsarpalis