Proposal: Add `maxOn` and `minOn` functions to Data.Ord

Daniel Díaz Casanueva dhelta.diaz at gmail.com
Fri May 27 20:30:54 UTC 2016


On Fri, May 27, 2016 at 3:02 PM, Edward Kmett <ekmett at gmail.com> wrote:

> Note: in general we have chosen to supply By methods, rather than On
> methods, because he on combinator can be used to get one in terms of the
> other. We explicitly added sortOn because it can use a Schwartzian
> transform to be more efficient than sortBy (comparing `on` f).
>
> These don't have direct analogues there, however. So that usual argument
> against adding these sorts of methods doesn't hold up.
>
> One thing of note is that what you are asking for here is usually called
> argmin and argmax. Perhaps consistency with the rest of mathematics should
> trump consistency with sortOn.
>
> IIRC, We already have Arg in Data.Semigroup for use with the Min and Max
> semigroups for this purpose, so such naming would fit.
>

I'm not particularly concerned about the names that we decide. I just used
those names because I thought they were intuitive for the current
community. I'm happy with any other names that make sense.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160527/07d3667b/attachment.html>


More information about the Libraries mailing list