My understanding is this:
Suppose that M1 and M2 are monads, that is, they provide unit and flatMap functions that comply with monadic laws. Unfortunately, we cannot create unit and flatMap for M1[M2] . It seems that unit and flatMap do not always exist for any M1 and M2 . I do not know if we need to prove it.
So, the solution is to create a W wrapper for M1[M2] , so W[M1, M2] is a monad and uses it instead. This W shell is called Monad Transformer.
Do I understand this correctly?
scala functional-programming monads monad-transformers
Michael
source share