MonadWriter instance for ListT
ekmett at gmail.com
Sat Mar 13 09:56:54 EST 2010
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
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. ;)
On Fri, Mar 12, 2010 at 8:00 PM, Nicolas Frisby <nicolas.frisby at 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
> *> 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 at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries