maximum package:rio

O(n) maximum returns the maximum value from a ByteString
O(n) maximum returns the maximum value from a ByteString An exception will be thrown in the case of an empty ByteString.
The largest element of a non-empty structure. This function is non-total and will raise a runtime exception if the structure happens to be empty. A structure that supports random access and maintains its elements in order should provide a specialised implementation to return the maximum in faster than linear time.

Examples

Basic usage:
>>> maximum [1..10]
10
>>> maximum []
*** Exception: Prelude.maximum: empty list
>>> maximum Nothing
*** Exception: maximum: empty structure
WARNING: This function is partial for possibly-empty structures like lists.
O(n) maximum returns the maximum value from a Text, which must be non-empty.
The largest element of a non-empty structure with respect to the given comparison function.

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.

Examples

Basic usage:
>>> bimaximum (42, 17)
42
>>> bimaximum (Right 42)
42
>>> bimaximum (BiList [13, 29, 4] [18, 1, 7])
29
>>> bimaximum (BiList [13, 29, 4] [])
29
On empty structures, this function throws an exception:
>>> bimaximum (BiList [] [])
*** Exception: bimaximum: empty structure
...
The largest element of a non-empty structure with respect to the given comparison function.

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
...