In the previous recipe, we worked with the Reader monad transformer. In this recipe, we will work with the Writer monad transformer. Like the Reader monad transformer, the Writer monad transformer is also a restricted version of a state transformer, in which we can only write (but cannot read).
Working with the Writer monad transformer
Getting ready
In this example, we will use the Writer monad transformer to keep updating a balance sheet with transactions. We will keep pushing transactions to the Writer monad, finally yielding the balance after all transactions are processed.
We will work with the mtl library in this recipe.