If anything there is already too much in the MonadWriter class, 'pass' and 'listen' actively get in the way of logically valid instances.  i.e. one that just logged its output out to a filestream using IO. The current MonadWriter prevents the existence of an instance for ContT r Writer as well.

I'm hesitant to add more responsibility to MonadWriter. In this, I think MonadLib gets it right; if necessary, 'pass' and 'listen' could then be foisted off on another class. Sadly, it is not really an option to split MonadWriter in the MTL at this late date.

However, for consistency, I agree with you. If they must be present, it would at least be nice if you could get them to give consistent results. ;)

-Edward Kmett

On Fri, Mar 12, 2010 at 8:00 PM, Nicolas Frisby <nicolas.frisby@gmail.com> wrote:
*> runWriter . runErrorT $ censor (filter (/=3)) $ tell [1,2,3] >> throwError ""
(Left "",[1,2,3])


That's kind of weird, right? I understand why it is that way. I think
this is reason enough to make censor part of the class, since it
wouldn't have this short-coming if it weren't defined in terms of
pass.

*> let censorErrorT f (ErrorT m) = ErrorT (censor f m)
*> runWriter . runErrorT $ censorErrorT (filter (/=3)) $ tell [1,2,3]
>> throwError ""
(Left "",[1,2])

Or is it preferable for censor and pass to misbehave in the same way?
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://www.haskell.org/mailman/listinfo/libraries