<div dir="ltr">Dear Henning,<div><br></div><div>Thank you for your response! I think I have caused some confusion by not being quite clear in my email. Sorry!</div><div><br></div><div>base _does_ contain Ord instances for both Maybe and Either. So the question of what the smallest (Maybe Int8) is, is settled: It's Nothing.</div><div><br></div><div>My question is, why the corresponding Bounded instances are missing from base. After all they could simply re-use the bounds implied by the Ord instances.</div><div><br></div><div>Thanks,</div><div>Simon</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Mo., 4. Mai 2020 um 15:30 Uhr schrieb Henning Thielemann <<a href="mailto:lemming@henning-thielemann.de">lemming@henning-thielemann.de</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On Mon, 4 May 2020, Simon Jakobi via Libraries wrote:<br>
<br>
> Possibly relatedly, I was looking for Bounded instances for Maybe and <br>
> Either. To me the following instances seem sensible:<br>
> <br>
> instance Bounded a => Bounded (Maybe a) where<br>
>    minBound = Nothing<br>
>    maxBound = Just maxBound<br>
> <br>
> instance (Bounded a, Bounded b) => Bounded (Either a b) where<br>
>   minBound = Left minBound<br>
>   maxBound = Right maxBound<br>
> <br>
> Are these instances omitted for a reason? Interestingly, both types do have corresponding Ord instances.<br>
<br>
Unfortunately, Ord is dual use:<br>
<br>
1. Comparison for magnitude as suggested by the mathematical symbols (<) <br>
and (>).<br>
<br>
2. Some arbitrary but total order for use in Set and Map.<br>
<br>
E.g. Set (Complex a) makes total sense, but 1:+0 > 0:+1 is unexpected. Ord <br>
instances on pairs is sensible for Set and Map, but (max (1,0) (0,1) == <br>
(1,0)) is strange.<br>
<br>
I would not interpret too much into (Bounded a => Maybe a). Nothing may <br>
mean "smaller than any Just element", but it may also mean "larger than <br>
any Just element" or "no regular element at all".<br>
<br>
Consider a refactoring where a numeric value is extended by Maybe. Do we <br>
want that comparisons and bounds are silently re-interpreted or would we <br>
like to be alerted that comparisons and bounds don't make sense anymore? <br>
I'd prefer the alert. Unfortunately, Ord Maybe is already defined.<br>
<br>
For an extra largest or smallest element I would define a custom <br>
Maybe-like datatype.</blockquote></div>