
On Wed, 5 Dec 2012, Daniel Fischer wrote:
On Mittwoch, 5. Dezember 2012, 09:23:31, Simon Hengel wrote:
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.
I'm not against it, but I would like to ask whether these are really used so frequently that
Prelude> :t either Just (const Nothing) either Just (const Nothing) :: Either a b -> Maybe a
is too cumbersome.
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