Proposal: Add isLeft/isRight to Data.Either

Bryan O'Sullivan bos at serpentine.com
Wed Dec 5 18:33:12 CET 2012


On Wed, Dec 5, 2012 at 8:16 AM, Henning Thielemann <
lemming at henning-thielemann.de> wrote:

> The same can be asked for
>
> Prelude> :t either (const False) (const True)
> either (const False) (const True) :: Either a b -> Bool
>
> or
>
> isLeft = isJust . maybeLeft
>

We at least have evidence that isLeft and isRight are actually present in
several packages. That helps this proposal squeak over my bar, so I'm +0 on
it.

I think that maybeLeft and maybeRight are interesting, but the burden of
proof for "these things solve a problem that actually exists" is a little
higher. Consider me -0.01.

In general, I feel we have a fondness for a few too many near-trivial
one-liners that make libraries bigger and harder to navigate, without
really adding much expressivity.

For instance, aeson has a couple of combinators that are intended to help
with structure access and lookup, and I've gotten pull requests for a bunch
more due to the existing precedents, but they all have me feeling that the
first few were wrong and the rest are even more wrong: they don't compose.
Either lenses or a little DSL would have been better choices.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20121205/a1281e7c/attachment.htm>


More information about the Libraries mailing list