Personally I like having both Maximum-and-Minimum-with-sentinel version like the proposed Maximum and Minimum here, along with the simpler Max and Min semigroups that upgrade themselves to a Monoid when Bounded is present.<div>
<br></div><div>Each is useful for different usecases. I like having access to the efficient version whenever I know the target admits a minimum value (like Int).</div><div><br></div><div>Paying for unnecessary Maybe's makes me cry.</div>
<div><br></div><div>-Edward</div><div><br><div class="gmail_quote">On Fri, Dec 28, 2012 at 4:39 PM, Gabriel Gonzalez <span dir="ltr"><<a href="mailto:gabriel439@gmail.com" target="_blank">gabriel439@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm still not convinced by the Bounded instance for Maybe, which seems like a hack. I would prefer to just use the Monoid instance for "Maybe (Max a)" and just fmap "getMaximum" over the result rather than pretend that Maybe is Bounded when it's not.<br>
<br>
Moreover, the entire Bounded constraint seems wrong in principle. There is no intuitive reason why some type should be bounded to be able to take a maximum of a set of elements. The Ord constraint should be sufficient to define a maximum.<br>
<br>
I also don't think it is a good idea to have direct Monoid instances for Max and Min, because they behave weirdly on empty lists. Do you really think that "minimum [] :: Int" should be defined? I still believe that the correct answer for "minimum []" should be Nothing or a similar type with a distinguished infinity like those that Roman proposed.``<div class="HOEnZb">
<div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br></div>