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.<div>
<div><br></div><div>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.</div>
<div><br></div><div>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. ;)</div><div><br></div><div>-Edward Kmett</div><div><br>
</div><div><div><div class="gmail_quote">On Fri, Mar 12, 2010 at 8:00 PM, Nicolas Frisby <span dir="ltr"><<a href="mailto:nicolas.frisby@gmail.com">nicolas.frisby@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
*> runWriter . runErrorT $ censor (filter (/=3)) $ tell [1,2,3] >> throwError ""<br>
(Left "",[1,2,3])<br>
<br>
<br>
That's kind of weird, right? I understand why it is that way. I think<br>
this is reason enough to make censor part of the class, since it<br>
wouldn't have this short-coming if it weren't defined in terms of<br>
pass.<br>
<br>
*> let censorErrorT f (ErrorT m) = ErrorT (censor f m)<br>
*> runWriter . runErrorT $ censorErrorT (filter (/=3)) $ tell [1,2,3]<br>
>> throwError ""<br>
(Left "",[1,2])<br>
<br>
Or is it preferable for censor and pass to misbehave in the same way?<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</blockquote></div><br></div></div></div>