maximumBy package:base

The largest element of a non-empty structure with respect to the given comparison function. Structure order is used as a tie-breaker: if there are multiple largest elements, the rightmost of them is chosen.

Examples

Basic usage:
>>> maximumBy (compare `on` length) ["Hello", "World", "!", "Longest", "bar"]
"Longest"
WARNING: This function is partial for possibly-empty structures like lists.
The largest element of a non-empty structure with respect to the given comparison function. Structure order is used as a tie-breaker: if there are multiple largest elements, the rightmost of them is chosen.
The largest element of a non-empty structure with respect to the given comparison function. Structure order is used as a tie-breaker: if there are multiple largest elements, the rightmost of them is chosen.

Examples

Basic usage:
>>> bimaximumBy compare (42, 17)
42
>>> bimaximumBy compare (Left 17)
17
>>> bimaximumBy compare (BiList [42, 17, 23] [-5, 18])
42
On empty structures, this function throws an exception:
>>> bimaximumBy compare (BiList [] [])
*** Exception: bifoldr1: empty structure
...