MonadWriter instance for ListT
Nicolas Frisby
nicolas.frisby at gmail.com
Fri Mar 12 20:00:30 EST 2010
*> 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?
More information about the Libraries
mailing list