
There's also (\(Right x)->x), which is pretty short and will give you a warning about the missing case. (I could go either way on adding fromLeft/Right though) Tom
El 20 may 2016, a las 19:22, Francesco Ariis
escribió: 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 typing:
λ> 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!
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries