<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Is the fundamental question whether we require that types that
      implement both Ord and Enum have these laws?</p>
    <blockquote>
      <p> <font size="+1"><tt>succ x > x</tt><tt><br>
          </tt></font></p>
      <p><font size="+1"><tt>x > y == fromEnum x > fromEnum y</tt></font></p>
    </blockquote>
    <p>If we require it then this change is mandatory, if we don't
      require that then it's optional and whatever argument we have
      against the laws might be an argument against this change.<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 18/09/2020 17:19, David Beacham
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAF1zU3ys7g9dhzgFRegnoupBo4ngnEUR6SN3UBkdMxE-UdRFfw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>That is a good spot - I had wondered if the
          minBound/maxBound changes would affect other classes but had
          missed Enum.</div>
        <div><br>
        </div>
        <div>I wouldn't be surprised that `Down a` had a reversed
          enumeration despite the `Ord`/`Enum` separation.</div>
        <div><br>
        </div>
        <div>
          <div>Looking at the `Bounded` docs</div>
        </div>
        <div>
          <div><br>
          </div>
          <div>> The Bounded class is used to name the upper and
            lower limits of a type. Ord is not a superclass of Bounded
            since types that are not totally ordered may also have upper
            and lower bounds.</div>
          <div><br>
          </div>
          <div>does suggest that flipping minBound and maxBound is
            correct? That would then require `Enum a => Enum (Down
            a)` should also be flipped given the way it interacts with
            `Bounded`?</div>
        </div>
        <div><br>
        </div>
        <div>I think the instance is achievable by</div>
        <div><br>
        </div>
        <div>1. flipping pred/succ</div>
        <div>2. carefully using "negated Int"s when looking at
          `fromEnumThenTo` etc.</div>
        <div><br>
        </div>
        <div>I think you get the choice of keeping the same `Int`
          conversions, `toEnum = Down . toEnum`, or negating it, `toEnum
          = Down . toEnum . negate`, so e.g. 0 -> False, 1 -> True
          becomes 0 -> Down False, -1 -> Down True.</div>
        <div><br>
        </div>
        <div>I can add potential implementations to the MR so that there
          is something concrete to look at (and check it all works) or
          do it here.<br>
        </div>
        <div><br>
        </div>
        <div>But I think it all needs a bit more discussion than I'd
          initially thought!</div>
        <div><br>
        </div>
        <div>David.<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Sep 18, 2020 at 3:41
          PM Oleg Grenrus <<a href="mailto:oleg.grenrus@iki.fi"
            moz-do-not-send="true">oleg.grenrus@iki.fi</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">
          <div>
            <p>Is it (a bug)?<br>
              <br>
              What about [minBound .. maxBound]. If you change
              `Bounded`, you need to change `Enum` too.<br>
              <br>
              From
              <a
href="https://hackage.haskell.org/package/base-4.14.0.0/docs/GHC-Enum.html#t:Enum"
                target="_blank" moz-do-not-send="true">https://hackage.haskell.org/package/base-4.14.0.0/docs/GHC-Enum.html#t:Enum</a><br>
              <br>
              - The calls succ maxBound and pred minBound should result
              in a runtime error.<br>
              - enumFrom and enumFromThen should be defined with an
              implicit bound</p>
            <p>The `min` and `max` in `minBound/maxBound` are related to
              `succ`, `pred`, not to `compare`. If you argue against,
              then we should add `Ord` super-class to `Enum` (and
              `Bounded`).<br>
            </p>
            <p>- Oleg<br>
            </p>
            <div>On 18.9.2020 16.54, Carter Schonwald wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="auto">Def a bug! Plz at myself and the core
                libraries handle for code review plz. </div>
              <div dir="auto"><br>
              </div>
              <div dir="auto">This sounds kinda related to an MR that
                has languished too long regarding the behavior of Down
                on Ord1, which I think is related??? (I tried to
                arbitrate / layout possible answers for the related
                issue in the associated mr, but none of the clc members
                have engaged in the design space challenge)</div>
              <div><br>
                <div class="gmail_quote">
                  <div dir="ltr" class="gmail_attr">On Fri, Sep 18, 2020
                    at 7:44 AM David Beacham <<a
                      href="mailto:mail@dbeacham.co.uk" target="_blank"
                      moz-do-not-send="true">mail@dbeacham.co.uk</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">
                    <div dir="ltr">
                      <div>Hi all,</div>
                      <div><br>
                      </div>
                      <div>The current instance for `Bounded a =>
                        Bounded (Down a)` derives the `minBound` and
                        `maxBound` exactly as they are for the
                        underlying type `a` where I think they should be
                        flipped to respect the flipped ordering of `Down
                        a`?</div>
                      <div><br>
                      </div>
                      <div>I have a feeling this has been come up in
                        some other context/list before but I couldn't
                        find a reference to it when searching - so sorry
                        if this is a duplicate.</div>
                      <div><br>
                      </div>
                      <div>I've got a corresponding MR here: <a
                          href="https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4081"
                          target="_blank" moz-do-not-send="true">https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4081</a></div>
                      <div><br>
                      </div>
                      <div>Thanks, David.<br>
                      </div>
                    </div>
                    <br>
                    <br>
                    _______________________________________________<br>
                    <br>
                    Libraries mailing list<br>
                    <br>
                    <a href="mailto:Libraries@haskell.org"
                      target="_blank" moz-do-not-send="true">Libraries@haskell.org</a><br>
                    <br>
                    <a
                      href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
                    <br>
                  </blockquote>
                </div>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
Libraries mailing list
<a href="mailto:Libraries@haskell.org" target="_blank" moz-do-not-send="true">Libraries@haskell.org</a>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank" moz-do-not-send="true">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a>
</pre>
            </blockquote>
          </div>
          _______________________________________________<br>
          Libraries mailing list<br>
          <a href="mailto:Libraries@haskell.org" target="_blank"
            moz-do-not-send="true">Libraries@haskell.org</a><br>
          <a
            href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries"
            rel="noreferrer" target="_blank" moz-do-not-send="true">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Libraries mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libraries@haskell.org">Libraries@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a>
</pre>
    </blockquote>
  </body>
</html>