Proposal: add fromRight and fromLeft to Data.Either

Theodore Lief Gannon tanuki at gmail.com
Fri May 20 22:42:55 UTC 2016


js :: a -> (Void, a)
js x = (undefined, x)

left :: (Void, Either a b) -> a
left (_, Left x) = x

There we go... now it looks truly terrifying:

left.js $(myValue)


(Apologies to Kosyrev for the double-send. Especially since that version
was broken.)

On Fri, May 20, 2016 at 2:36 PM, Kosyrev Serge <_deepfire at feelingofgreen.ru>
wrote:

> Dan Burton <danburton.email at gmail.com> writes:
> > I wouldn't mind something like this being available... but only if
> > prefixed with the word "unsafe" or "partial" or other such scary
> > words.
>
> Heh, `unsafePerformLeft` / `unsafePerformRight` ? : -)
>
> --
> с уважениeм / respectfully,
> Косырев Сергей
> _______________________________________________
> 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/20160520/5a25c9f5/attachment-0001.html>


More information about the Libraries mailing list