Closed ivan-timokhin closed 6 years ago
Previous version would accumulate the entire log unchanged, and then append a modified version at the end; the new one removes the old log entries by replacing them with mempty.
mempty
Here's an example (any execWriter from mtl):
execWriter
execWriter $ runEffect $ pass $ tell [1] >> pure ((), (2:))
Previously, this would evaluate to [1,2,1] (old log + modified old log); now, it evaluates to [2,1], same as when using just WriterT.
[1,2,1]
[2,1]
WriterT
Ah, good catch! Yes, I agree that your version is the correct behavior
No credit to me, I picked the idea from free.
free
This is now up on Hackage as pipes-4.3.6
pipes-4.3.6
Previous version would accumulate the entire log unchanged, and then append a modified version at the end; the new one removes the old log entries by replacing them with
mempty
.Here's an example (any
execWriter
from mtl):Previously, this would evaluate to
[1,2,1]
(old log + modified old log); now, it evaluates to[2,1]
, same as when using justWriterT
.