Stricter WriterT (Part II)

Ross Paterson R.Paterson at city.ac.uk
Mon May 20 17:17:46 CEST 2013


On Sun, Mar 17, 2013 at 09:18:13AM -0700, Gabriel Gonzalez wrote:
> So I propose that we add an additional stricter WriterT (under say,
> "Control.Monad.Trans.Writer.Stricter") which is internally
> implemented as StateT, but hide the constructor so we don't expose
> the implementation:
> 
> newtype WriterT w m a = WriterT { unWriterT :: w -> m (a, w) }

That would be slightly less transparent than the other transformers,
and it wouldn't be perfectly parallel to the existing versions of WriterT:
- the Applicative and Alternative instances would have different contexts
- there would be no Foldable or Traversable instances

On Tue, Mar 19, 2013 at 08:33:37PM -0400, Edward Kmett wrote:
> I use them fairly heavily, mostly so I can make packages that work with
> arbitrary transformer stacks.

There are several packages like this, that pass various stuff through all
the transformers.  Relatively few seem to use the strict writer for itself:

	alms darcswatch ghc-heap-view Glob GPipe-Collada Haschoo hbayes
	nemesis satchmo shake storable XmlHtmlWriter

I wonder if these users were expecting the linear behaviour that Gabriel
was exploring.

So perhaps the best thing would be to deprecate Writer.Strict in favour
of State.Strict.



More information about the Libraries mailing list