3 ms·
Excellent write up. One point though: watch out for WriterT and RWST leaking memory: http://stackoverflow.com/questions/25280852/space-leak-in-pipes-with-rwst
by boothead 10y ago
Excellent write up. One point though: watch out for WriterT and RWST leaking memory:
http://stackoverflow.com/questions/25280852/space-leak-in-pipes-with-rwst http://stackoverflow.com/questions/25280852/space-leak-in-pi...
It's often better to just include the writer part you need in a larder State type (lenses make this really seamless)/
- tikhonj 10y agoThat's a good point, but it was also mentioned in the article, with a link to a useful mailing list thread[1] on the matter. It seems to be a matter of laziness. If you're writing some small piece of state like an Int, this can be a real problem. If you're writing out a lazy data structure like a list (as happens in the article), I think the extra laziness should be fine or even desired. (I've never used Writer in practice, so take my comments with a grain of salt!) [1]: http://comments.gmane.org/gmane.comp.lang.haskell.libraries/18980 http://comments.gmane.org/gmane.comp.lang.haskell.libraries/...
- boothead 10y agoIt was? I still can't see it... AFAIR the problem with WriterT was the use of mappend within is always lazy, regardless of the strictness of the w in WriterT w m a.
- wyager 10y agoYep, I mentioned this at the bottom of "monad it".