Proposal: Add `maxOn` and `minOn` functions to Data.Ord
Jon Fairbairn
jon.fairbairn at cl.cam.ac.uk
Mon May 30 08:11:58 UTC 2016
Daniel Díaz Casanueva <dhelta.diaz at gmail.com> writes:
> I think these are useful in general, and that they would make a good
> addition to `Data.Ord`. The names are inspired by `sortOn`. Definitions:
>
> ```
> minOn :: Ord b => (a -> b) -> a -> a -> a
> minOn f x y =
> case comparing f x y of
> LT -> x
> _ -> y
Bad name; it’s too close to on min, which has the same type.
--
Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
More information about the Libraries
mailing list