concrete functor and monad transformers
#31Stricter Writer
Hi,
I made the packages writer-cps-mtl and writer-transformers-mtl which implement a stricter writer monad transformer in continuation passing style as was discussed before on the Haskell mailing list etc
- http://hackage.haskell.org/package/writer-cps-mtl
- http://hackage.haskell.org/package/writer-cps-transformers
See also the current reddit discussion:
https://www.reddit.com/r/haskell/comments/50hf2s/stricter_writert_and_rwst_replacements/
and the mtl issue on github:
https://github.com/ekmett/mtl/issues/38
Daniel
I agree that this should be in transformers.
This issue has been brought up again recently https://www.reddit.com/r/haskell/comments/87ijm4/the_task_abstraction/dwd9dju/
It's really not obvious from the documentation that the runtime characteristics of the default
WriterT
are not what most people expect, much less where to find a better alternative.The
transformers
package now provides theAccumT
monad transformer. This is very nearly whatwriter-cps-transformers
offers. However,Accum
is lazy in the accumulator. One easy solution would be to provide aControl.Monad.Trans.Accum.Strict
module. Ross, would you accept a PR that provided this new module as well as improvement to the documentation ofWriterT
explaining thatAccumT
should be used to get a strict accumulator?So we'd have strict and lazy AccumT differing only in pattern matching, like strict and lazy StateT and WriterT? That sounds good.
Cool. I can write a patch for this. I’ll try to get this up soon.
Ross, I've written up a patch for this here: https://hub.darcs.net/andrewthad/transformers/patch/b680781658c8b7b13edb59055408797ff1ab3927. I don't know how to PR in darcshub, but let me know any feedback you have.
Looking more closely, I don't think a variant of AccumT is the monad you're looking for.
writer-cps-transformers
is a restricted state monad.What is needed to advance this issue?
- status set to closed
I have incorporated the two modules from writer-cps-transformers
Amazing <3. Thank you!