Proposal: add fromRight and fromLeft to Data.Either

Francesco Ariis fa-ml at
Fri May 20 23:22:36 UTC 2016

On Fri, May 20, 2016 at 10:08:40PM +0200, Anton Felix Lorenzen wrote:
> When working with Either,
> I am often missing two simple functions:
> fromRight :: Either a b -> b
> fromLeft  :: Either a b -> a

Sometimes my lazy inner-self is guilty of longing for `fromRight` when

    λ> either undefined id xyz

but then again, importing Data.Either wouldn't make thing any shorter :P

    λ> :m +Da<tab>.Ei<tab>
    λ> fromRight zyx

I can see fromRight being useful in one-off script; anything bigger than
a few lines is asking for trouble!

More information about the Libraries mailing list