darcs patch: Adding isLeft, isRight, fromLeft, fromRight, splitEithers

Bulat Ziganshin bulat.ziganshin at gmail.com
Tue Oct 31 06:18:38 EST 2006


Hello David,

Tuesday, October 31, 2006, 1:23:19 PM, you wrote:

>>  * Adding isLeft, isRight, fromLeft, fromRight, splitEithers

> It'd be nice to have the following, too:

> lefts :: [Either a b] -> [a]
> lefts = fst . splitEithers
> rights :: [Either a b] -> [b]
> rights = snd . splitEithers

i think that this may be faster:

lefts = filter isLeft
rights = filter isRight


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Libraries mailing list