maximumBy -is:exact -is:exact is:exact
The largest element of a non-empty structure with respect to the given
comparison function.
The
maximumBy function takes a comparison function and a list
and returns the greatest element of the list by the comparison
function. The list must be finite and non-empty.
We can use this to find the longest entry of a list:
>>> maximumBy (\x y -> compare (length x) (length y)) ["Hello", "World", "!", "Longest", "bar"]
"Longest"