Reputation: 42050
My understanding is the following:
Suppose M1
and M2
are monads, i.e. they provide functions unit
and flatMap
that comply to the monadic laws. Unfortunately we cannot create unit
and flatMap
for M1[M2]
. It looks like the unit
and flatMap
don't always exist for any M1
and M2
. I do not know if we need to prove it.
So the solution is to create a wrapper W
for M1[M2]
, so that W[M1, M2]
is a monad, and use it instead. This wrapper W
is called Monad Transformer.
Do I understand it correctly ?
Upvotes: 8
Views: 466