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

  • Universal Mutator

    Defines a generic `mutate : 'T -> 'T` function that structurally mutates every value in the object graph, without performing new allocations. Needless to say, this is intended for educational purposes only.

    2 people like this

    Posted: 2 months ago by Eirik Tsarpalis