Proposal: add fromRight and fromLeft to Data.Either
Edward Kmett
ekmett at gmail.com
Sun Jun 12 19:51:11 UTC 2016
Putting on my CLC hat to summarize the talk so far into a concrete plan:
It looks like there is sufficient consensus to add the
fromLeft :: a -> Either a b -> a
fromRight :: b -> Either a b -> b
variants to Data.Either, so let's do that.
This avoids partiality concerns, and seems to have broad support. I'll
modify the `either` package to re-export them once they make it into base
to avoid import conflicts.
Does someone want to bang out a patch?
-Edward
On Sun, Jun 12, 2016 at 2:29 AM, Erik de Castro Lopo <mle+hs at mega-nerd.com>
wrote:
> 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?
>
> -1 on the addition of yet another partial function.
>
> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> http://www.mega-nerd.com/
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160612/f5a5101c/attachment.html>
More information about the Libraries
mailing list