News for hackers. Stuff that matters.
Re:Monads for functional programming (1995) [pdf] by edflsafoiewq on Sunday May 06, 2018 @07:01PM (#17009137)
Not really. You can see the basic idea on the nLab: https://ncatlab.org/nlab/show/variety+of+algebras#free_algeb...

Continuing the example I gave, the monad law "Identity" says that "trivial subexpressions are already simplified"

     a+b  = (a)+(b)
     ||       ||
    (a+b)  =  a+b
and the monad law "Associativity" says that "order of simplification doesn't matter"

    ((a)+(b))+((c+d)+(e)) = (a)+(b)+(c+d)+(e)
           ||                    ||
      (a+b)+(c+d+e)     =     a+b+c+d+e
The laws for an algebra for a monad say "Trivial expressions evaluate to themselves"

    a = (a) = a
and "you get the same result no matter the order you do evaluations and simplifications"

    (6+1)+(3) = 7+3 
       ||        ||
      6+1+3   =  10

There are no comments on this comment yet.