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 thisPosted: 1 years ago by Eirik Tsarpalis
c.f. http://fssnip.net/qR In this example different syntactic structures result in different types.
0 people like thisPosted: 1 years ago by Eirik Tsarpalis