Monad

From Adam Colton
Jump to navigation Jump to search

Monoid

Must be associative

 (a ⊕ b) ⊕ c ↔ a ⊕ (b ⊕ c)

Has an identity

 a ⊕ I = a
 I ⊕ a = a

(I'm not sure if there is one identity or if there can be two)

Does not have to be commutative

 a ⊕ b ↛ b ⊕ a

Monad

This may not be right...

Basic composition says given

 type F func(T) T
 
 func compose(f,g F) F{
   return func(T) T{
     return f(g(t))
   }
 }

This breaks down with

 type F func(Ta) Tb

because that symmetry is lost.

So the monad is the corresponding

 type func(Tb, F) Tb