Proposal: Add isLeft/isRight to Data.Either

Thomas Schilling nominolo at
Wed Dec 5 01:14:48 CET 2012

On 4 December 2012 22:04, Henning Thielemann
<lemming at> wrote:
> However, I think I would prefer maybeLeft and maybeRight.

I'd also prefer these names.

I haven't had much use for any of these functions since I usually use
custom types instead of Either, but I think they are obvious, simple
and small functions, so I think it's a good idea to have them in the
standard library rather than have everyone define their own version.

+1 for isLeft/isRight, maybeLeft/maybeRight

I'm not a fan of partial functions like fromLeft/fromRight. They lead
to horrible error messages in current GHCs, so I would always write
them as  "let Left x = ... in ...".  I'm not voting against them, but
I'm also not voting for them, either.

/ Thomas

More information about the Libraries mailing list