:: Ord b => (a -> b) -> [a] -> a

A version of maximum where the comparison is done on some extracted value. Raises an error if the list is empty. Only calls the function once per element.
maximumOn id [] == undefined
maximumOn length ["test","extra","a"] == "extra"
A version of minimum where the comparison is done on some extracted value. Raises an error if the list is empty. Only calls the function once per element.
minimumOn id [] == undefined
minimumOn length ["test","extra","a"] == "a"
argmin
argmax
The largest element of a non-empty data structure with respect to the given comparison function.
>>> maximumOn1 abs (0 :| [2, 1, -3, -2])
-3
The smallest element of a non-empty data structure with respect to the given comparison function.
>>> minimumOn1 abs (0 :| [2, 1, -3, -2])
0