<div dir="auto">That strikes me as quite reasonable.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 21, 2020, 1:09 PM Krzysztof Gogolewski <<a href="mailto:krz.gogolewski@gmail.com">krz.gogolewski@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I would consider removing Enum a => Enum (Down a), and fixing Bounded (Down a).<br>
<br>
There isn't really a good equivalent of `enumFromThenTo` for Down and<br>
performing negation in `toEnum` is not obvious to me.<br>
<br>
On Sat, Sep 19, 2020 at 3:00 AM Kim-Ee Yeoh <<a href="mailto:ky3@atamo.com" target="_blank" rel="noreferrer">ky3@atamo.com</a>> wrote:<br>
><br>
><br>
><br>
> On Sat, Sep 19, 2020 at 1:34 AM Asad Saeeduddin <<a href="mailto:masaeedu@gmail.com" target="_blank" rel="noreferrer">masaeedu@gmail.com</a>> wrote:<br>
>><br>
>> 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?<br>
><br>
><br>
> It's not a bijection with the integers.<br>
><br>
> In the method fromEnum :: a -> Int, the Int stands in for the disjoint sum of all possible types with an Enum instance.<br>
><br>
> And the way Int finesses that impersonation is by conflating together the parts of the disjoint sum.<br>
><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> On 9/18/20 10:40 AM, Oleg Grenrus<br>
>><br>
>> wrote:<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> 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" rel="noreferrer noreferrer" 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<br>
>><br>
>><br>
>><br>
>> 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>
>><br>
>><br>
>> - Oleg<br>
>><br>
>><br>
>><br>
>><br>
>> On 18.9.2020 16.54, Carter Schonwald<br>
>><br>
>> wrote:<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> Def a bug! Plz at myself and the core libraries<br>
>><br>
>> handle for code review plz.<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> 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)<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> On Fri, Sep 18, 2020 at<br>
>><br>
>> 7:44 AM David Beacham <<a href="mailto:mail@dbeacham.co.uk" target="_blank" rel="noreferrer">mail@dbeacham.co.uk</a>><br>
>><br>
>> wrote:<br>
>><br>
>><br>
>><br>
>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> Hi all,<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> 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`?<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> 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.<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> I've got a corresponding MR here: <a href="https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4081" rel="noreferrer noreferrer" target="_blank">https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4081</a><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> Thanks, David.<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><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" rel="noreferrer">Libraries@haskell.org</a><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>><br>
>> Libraries mailing list<br>
>><br>
>> <a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
>><br>
>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>><br>
>> Libraries mailing list<br>
>><br>
>> <a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
>><br>
>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>><br>
>> Libraries mailing list<br>
>><br>
>> <a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
>><br>
>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
>><br>
> --<br>
> -- Kim-Ee<br>
> _______________________________________________<br>
> Libraries mailing list<br>
> <a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>