Proposal: Add isLeft/isRight to Data.Either

Simon Hengel sol at typeful.net
Wed Dec 5 09:23:31 CET 2012


Hi Herbert,

On Tue, Dec 04, 2012 at 11:02:07PM +0100, 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

There seems to be support for this.  I think it would be useful to have
a separate proposal/patch.

Cheers,
Simon



More information about the Libraries mailing list