Proposal: Add isLeft/isRight to Data.Either

Erik Hesselink hesselink at gmail.com
Fri Dec 7 19:38:41 CET 2012


On Friday, December 7, 2012, Thomas Schilling wrote:

> On 7 December 2012 09:25, Erik Hesselink <hesselink at gmail.com<javascript:;>>
> wrote:
> > There is no need to define whenJust, since it is just a specialization
> > of forM_ from Data.Foldable.
>
> I don't know if that's such a good argument.  I prefer my code
> readable -- too much abstraction can have a seriously bad effect on
> that.  As a simple rule, if the user has to do type inference in their
> head, readability suffers.
>
> In this case, "forM_" implies we're iterating over something container
> like, "whenJust" means "I want to do something if this thing yielded a
> result". It depends on the context whether a "Maybe" is behaving more
> container-like or is indicating the presence of a result where there
> may not have been one.
>

I don't have this problem, but I guess that's just personal. But in general
I'm not in favor of adding specialized versions of generalized functions.

Erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20121207/eed37131/attachment.htm>


More information about the Libraries mailing list