<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <div class="moz-cite-prefix">On 05/30/2013 01:45 PM, Dan Burton
      wrote:<br>
    </div>
    <blockquote
cite="mid:CALSygwe8F-nz=3p3j4npUm+WU9Sw+x8sseq+cfnyfNzG7nxfAg@mail.gmail.com"
      type="cite">We have already right-biased Eithers in Haskell for
      Functor, Applicative, and Monad. We should be consistent and
      right-bias it for Foldable, Traversable, and similar typeclasses.
      Left-biasing can still be accomplished with a newtype wrapper, and
      perhaps we should consider including this in the standard
      libraries as well.
      <div>
        <br>
      </div>
    </blockquote>
    Keep in mind that `errors` can provide the `Left`-biased versions
    because it already has the appropriate newtype for doing so:
    `EitherR`.<br>
    <blockquote
cite="mid:CALSygwe8F-nz=3p3j4npUm+WU9Sw+x8sseq+cfnyfNzG7nxfAg@mail.gmail.com"
      type="cite">
      <div>Until the change happens, I'd suggest recommending that
        "errors" users requiring this functionality lean on the "lens"
        instances.</div>
      <div><br>
      </div>
      <div>-- Dan Burton</div>
      <div>
        <br>
        <br>
        <div class="gmail_quote">On Thu, May 30, 2013 at 1:12 PM,
          Shachaf Ben-Kiki <span dir="ltr">&lt;<a
              moz-do-not-send="true" href="mailto:shachaf@gmail.com"
              target="_blank">shachaf@gmail.com</a>&gt;</span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div class="im">On Thu, May 30, 2013 at 12:53 PM, Gabriel
              Gonzalez &lt;<a moz-do-not-send="true"
                href="mailto:gabriel439@gmail.com">gabriel439@gmail.com</a>&gt;
              wrote:<br>
              &gt; I'm surprised that `Either` does not have a
              `Foldable` instance of the form:<br>
              &gt;<br>
              &gt; &nbsp; &nbsp; import Data.Foldable<br>
              &gt; &nbsp; &nbsp; import Data.Monoid<br>
              &gt;<br>
              &gt; &nbsp; &nbsp; instance Foldable (Either e) where<br>
              &gt; &nbsp; &nbsp; &nbsp; &nbsp; foldMap f (Left &nbsp;_) = mempty<br>
              &gt; &nbsp; &nbsp; &nbsp; &nbsp; foldMap f (Right r) = f r<br>
              &gt;<br>
              &gt; &nbsp; &nbsp; &nbsp; &nbsp; foldr _ z (Left &nbsp;_) = z<br>
              &gt; &nbsp; &nbsp; &nbsp; &nbsp; foldr f z (Right r) = f r z<br>
              &gt;<br>
              &gt; In other words, the above instance would behave like
              the `Maybe` `Foldable`<br>
              &gt; instance, treating `Left` in the same way as
              `Nothing`.<br>
              &gt;<br>
              &gt; This came up in the context of an issue raised on the
              `errors` package:<br>
              &gt;<br>
              &gt; <a moz-do-not-send="true"
                href="https://github.com/Gabriel439/Haskell-Errors-Library/issues/16"
                target="_blank">https://github.com/Gabriel439/Haskell-Errors-Library/issues/16</a><br>
              &gt;<br>
              &gt; I could provide an orphan instance for `Either` in
              the `errors` package, but<br>
              &gt; I wanted to ask if it was possible to incorporate the
              instance directly into<br>
              &gt; `Data.Foldable`.<br>
              &gt;<br>
              <br>
            </div>
            This instance should exist. There's been a couple of
            discussion on<br>
            libraries@ before. One of them is at<br>
            &lt;<a moz-do-not-send="true"
              href="http://www.haskell.org/pipermail/libraries/2012-July/018246.html"
              target="_blank">http://www.haskell.org/pipermail/libraries/2012-July/018246.html</a>&gt;.<br>
            <br>
            I wrote a patch for base at one point --<br>
            &lt;<a moz-do-not-send="true"
href="http://shachaf.net/0001-Add-Foldable-and-Traversable-instances-for-Either-e-.patch"
              target="_blank">http://shachaf.net/0001-Add-Foldable-and-Traversable-instances-for-Either-e-.patch</a>&gt;<br>
            -- but didn't go through the rest of the process at the
            time.<br>
            <br>
            Right now `lens` has an orphan instance for this, by the
            way.<br>
            <span class="HOEnZb"><font color="#888888"><br>
                &nbsp; &nbsp; Shachaf<br>
              </font></span>
            <div class="HOEnZb">
              <div class="h5"><br>
                _______________________________________________<br>
                Libraries mailing list<br>
                <a moz-do-not-send="true"
                  href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
                <a moz-do-not-send="true"
                  href="http://www.haskell.org/mailman/listinfo/libraries"
                  target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>