<div dir="ltr"><div>It converts from Abortable (Either a b) to Either a (Abortable b).</div><div><br></div><div>My guess at their probable intent was that this operation tends to error without aborting more often than it errors from an abort, so they put the error on the outside so they can check the common case more easily.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 13, 2019 at 2:04 PM Dimitri DeFigueiredo <<a href="mailto:defigueiredo@ucdavis.edu">defigueiredo@ucdavis.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
Can anyone shed a light on the proper way to write the function below.<br>
It looks pretty standard, but it's not clear to me what it is?<br>
<br>
data Abortable res = Aborted | Executed res deriving Functor -- i.e. Maybe<br>
<br>
abortableThroughEither :: Abortable (Either a b) -> Either a (Abortable b)<br>
abortableThroughEither Aborted = Right Aborted<br>
abortableThroughEither (Executed (Left a)) = Left a<br>
abortableThroughEither (Executed (Right b)) = Right (Executed b)<br>
<br>
Thanks!<br>
<br>
Dimitri<br>
<br>
-- <br>
2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F<br>
<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>