<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>This is something I've never understood about `Enum`. How can a
type be in bijection with the integers, but simultaneously have a
minimum and maximum bound?<br>
</p>
<div class="moz-cite-prefix">On 9/18/20 10:40 AM, Oleg Grenrus
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:2b21571a-4516-a898-42e0-9911c4c6fa64@iki.fi">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<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 class="moz-txt-link-freetext"
href="https://hackage.haskell.org/package/base-4.14.0.0/docs/GHC-Enum.html#t:Enum"
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 class="moz-cite-prefix">On 18.9.2020 16.54, Carter Schonwald
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAHYVw0yo-vCMahbUa4o9Rqy8rZkfqaGU6Y2ZMSi37NKXNf-gCw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<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" moz-do-not-send="true">mail@dbeacham.co.uk</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;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 class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Libraries mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libraries@haskell.org" moz-do-not-send="true">Libraries@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" moz-do-not-send="true">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a>
</pre>
</blockquote>
<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>