Monad transformer: Difference between revisions

Content deleted Content added
Because there's multiple possible transformers for a given type, it's possible for them to be commutative, e.g. Reader and Exception, as Reader applies the monad before, and Exception after
Line 65:
*<math>\mathrm{lift}: \mathrm{M} \, A \rarr (A \rarr \mathrm{M} \, R) \rarr \mathrm{M} \, R = \mathrm{bind}</math>
 
Note that monad transformations are usually not [[commutative]]: for instance, applying the state transformer to the option monad yields a type <math>S \rarr \left(A \times S \right)^{?}</math> (a computation which may fail and yield no final state), whereas the converse transformation has type <math>S \rarr \left(A^{?} \times S \right)</math> (a computation which yields a final state and an optional return value).
 
== See also ==