Proposal: Add isLeft/isRight to Data.Either

Henning Thielemann lemming at henning-thielemann.de
Tue Dec 4 23:04:43 CET 2012


On Tue, 4 Dec 2012, Herbert Valerio Riedel wrote:

> btw, what I've been missing even more than isLeft/isRight is something
> like
>
> 	leftMaybe :: Either a b -> Maybe a
> 	leftMaybe (Left x) = Just x
> 	leftMaybe _        = Nothing
>
> 	rightMaybe :: Either a b -> Maybe b
> 	rightMaybe (Right x) = Just x
> 	rightMaybe _         = Nothing


These seem to be more useful for me than isLeft and isRight.

However, I think I would prefer maybeLeft and maybeRight.



More information about the Libraries mailing list