A lot of problems in haskell development is related with the problem of chaining effects. How do I insert an effect in a chain of computations?
Since the chain operation is bind, and has this signature:
(>>=) :: m a -> (a -> m b) -> m b
then the two operands: the result of the chain and the rest of the chain should be in the same monad, so they should have the same effects.
To overcome this problem the monad transformer and the free monad use the "runXXX" and the lift pattern with XXX being the effect desired can run for some time: