<div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Sep 19, 2020 at 1:34 AM Asad Saeeduddin <<a href="mailto:masaeedu@gmail.com">masaeedu@gmail.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div>    <p>This is something I've never understood about `Enum`. How can a<br><br>      type be in bijection with the integers, but simultaneously have a<br><br>      minimum and maximum bound?</p></div></blockquote><div dir="auto"><br></div><div dir="auto">It's not a bijection with the integers. </div><div dir="auto"><br></div><div dir="auto">In the method fromEnum :: a -> Int, the Int stands in for the disjoint sum of all possible types with an Enum instance.</div><div dir="auto"><br></div><div dir="auto">And the way Int finesses that impersonation is by conflating together the parts of the disjoint sum.</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div><p dir="auto"><br><br><br>    </p></div><div><br><br>    <div>On 9/18/20 10:40 AM, Oleg Grenrus<br><br>      wrote:<br><br><br>    </div><br><br>    <blockquote type="cite"><br><br>      <br><br>      <p>Is it (a bug)?<br><br><br>        <br><br><br>        What about [minBound .. maxBound]. If you change `Bounded`, you<br><br>        need to change `Enum` too.<br><br><br>        <br><br><br>        From<br><br>        <a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/GHC-Enum.html#t:Enum" target="_blank">https://hackage.haskell.org/package/base-4.14.0.0/docs/GHC-Enum.html#t:Enum</a><br><br><br>        <br><br><br>        - The calls succ maxBound and pred minBound should result in a<br><br>        runtime error.<br><br><br>        - enumFrom and enumFromThen should be defined with an implicit<br><br>        bound</p><br><br>      <p>The `min` and `max` in `minBound/maxBound` are related to<br><br>        `succ`, `pred`, not to `compare`. If you argue against, then we<br><br>        should add `Ord` super-class to `Enum` (and `Bounded`).<br><br><br>      </p><br><br>      <p>- Oleg<br><br><br>      </p><br><br>      <div>On 18.9.2020 16.54, Carter Schonwald<br><br>        wrote:<br><br><br>      </div><br><br>      <blockquote type="cite"><br><br>        <br><br>        <div dir="auto">Def a bug! Plz at myself and the core libraries<br><br>          handle for code review plz. </div><br><br>        <div dir="auto"><br><br><br>        </div><br><br>        <div dir="auto">This sounds kinda related to an MR that has<br><br>          languished too long regarding the behavior of Down on Ord1,<br><br>          which I think is related??? (I tried to arbitrate / layout<br><br>          possible answers for the related issue in the associated mr,<br><br>          but none of the clc members have engaged in the design space<br><br>          challenge)</div><br><br>        <div><br><br><br>          <div class="gmail_quote"><br><br>            <div dir="ltr" class="gmail_attr">On Fri, Sep 18, 2020 at<br><br>              7:44 AM David Beacham <<a href="mailto:mail@dbeacham.co.uk" target="_blank">mail@dbeacham.co.uk</a>><br><br>              wrote:<br><br><br>            </div><br><br>            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><br><br>              <div dir="ltr"><br><br>                <div>Hi all,</div><br><br>                <div><br><br><br>                </div><br><br>                <div>The current instance for `Bounded a => Bounded<br><br>                  (Down a)` derives the `minBound` and `maxBound`<br><br>                  exactly as they are for the underlying type `a` where<br><br>                  I think they should be flipped to respect the flipped<br><br>                  ordering of `Down a`?</div><br><br>                <div><br><br><br>                </div><br><br>                <div>I have a feeling this has been come up in some<br><br>                  other context/list before but I couldn't find a<br><br>                  reference to it when searching - so sorry if this is a<br><br>                  duplicate.</div><br><br>                <div><br><br><br>                </div><br><br>                <div>I've got a corresponding MR here: <a href="https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4081" target="_blank">https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4081</a></div><br><br>                <div><br><br><br>                </div><br><br>                <div>Thanks, David.<br><br><br>                </div><br><br>              </div><br><br>              <br><br><br>              <br><br><br>              _______________________________________________<br><br><br>              <br><br><br>              Libraries mailing list<br><br><br>              <br><br><br>              <a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br><br><br>              <br><br><br>              <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br><br><br>              <br><br><br>            </blockquote><br><br>          </div><br><br>        </div><br><br>        <br><br><br>        <fieldset></fieldset><br><br>        <pre style="font-family:monospace">_______________________________________________<br><br>Libraries mailing list<br><br><a href="mailto:Libraries@haskell.org" target="_blank" style="font-family:monospace">Libraries@haskell.org</a><br><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank" style="font-family:monospace">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br><br></pre><br><br>      </blockquote><br><br>      <br><br><br>      <fieldset></fieldset><br><br>      <pre style="font-family:monospace">_______________________________________________<br><br>Libraries mailing list<br><br><a href="mailto:Libraries@haskell.org" target="_blank" style="font-family:monospace">Libraries@haskell.org</a><br><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank" style="font-family:monospace">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br><br></pre><br><br>    </blockquote><br><br>  </div><br><br><br><br>_______________________________________________<br><br>Libraries mailing list<br><br><a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br><br></blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">-- Kim-Ee</div>