An accumulation monad parameterized by the type w of output to accumulate.
This monad is a more complex extension of both the reader and writer
monads. The return function produces the output mempty, while m
>>= k uses the output of m both to extend the initial environment
of k and to combine with the output of k:
In applications requiring only the ability to accumulate an output and to inspect the output so far, it would be considerably more efficient to use a state monad.