stateWriter package exposes a monad that has a similar API to the familiar
RWST transformer, but where the
Writer instance is implemented like the state part. As a result, this implementation does not leak memory, and is noticeably faster.
Unfortunately, there was a huge bug in the implementation of
listen, which is now fixed. All users are strongly encouraged to upgrade now.
This bug was found while proving that the transformer was sound. You might like reading the coq proof that proves compliance with the
State laws. Unfortunately, I could not find good laws for the
Reader parts. An ad-hoc test for the following law found the bug:
lift act = fmap (\v -> (v,mempty)) (lift act)
I will try to add a few more theorems in later versions!