Proposal: add fromRight and fromLeft to Data.Either
Anton Felix Lorenzen
anfelor at posteo.de
Fri Jun 3 15:49:02 UTC 2016
It has been two weeks now since I wrote my proposal.
First of all, thanks to all for their replies
(and sorry for having started such a big discussion).
Tom has mentioned, that there is (\(Right x)->x).
I didn't consider that (shame on me), but I think it is perfect
as it is short and easy to read.
Also it shows the idea of unwrapping,
something which "either undefined id" lacks.
I think it is a good replacement
and therefore withdraw my proposal.
Meanwhile, it was proposed to include
fromLeft :: a -> Either a b -> a
fromRight :: b -> Either a b -> b
I am a weak +1 on this.
--
Anton
On 05/20/2016 10:08 PM, 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
>
> It has been implemented a couple of times:
> http://hayoo.fh-wedel.de/?query=fromRight
>
> But I don't want to depend on yet another library
> for such a basic function.
>
> Could it be added?
>
> Anton
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
More information about the Libraries
mailing list