maximum

The largest element of a non-empty structure. This function is equivalent to foldr1 max, and its behavior on structures with multiple largest elements depends on the relevant implementation of max. For the default implementation of max (max x y = if x <= y then y else x), structure order is used as a tie-breaker: if there are multiple largest elements, the rightmost of them is chosen (this is equivalent to maximumBy compare). 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.
The largest element of a non-empty structure. This function is equivalent to foldr1 max, and its behavior on structures with multiple largest elements depends on the relevant implementation of max. For the default implementation of max (max x y = if x <= y then y else x), structure order is used as a tie-breaker: if there are multiple largest elements, the rightmost of them is chosen (this is equivalent to maximumBy compare).
>>> maximum (32 :| [64, 8, 128, 16])
128
maximum returns the maximum value from a list, which must be non-empty, finite, and of an ordered type. This function is equivalent to foldr1 max, and its behavior on lists with multiple maxima depends on the relevant implementation of max. For the default implementation of max, list order is used as a tie-breaker: if there are multiple maxima, the rightmost of them is chosen (this is equivalent to maximumBy compare).
>>> maximum []
*** Exception: Prelude.maximum: empty list

>>> maximum [42]
42

>>> maximum [55, -12, 7, 0, -89]
55

>>> maximum [1..]
* Hangs forever *
O(n) maximum returns the maximum value from a ByteString An exception will be thrown in the case of an empty ByteString.
maximum returns the maximum value from a ByteString
O(n) maximum returns the maximum value from a ByteString
O(n) maximum returns the maximum value from a Text, which must be non-empty.
O(n) maximum returns the maximum value from a stream, which must be non-empty. Properties
maximum . stream = maximum
Get the largest value in the stream, if present. Subject to fusion
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.
Find the maximum element of a Producer
argmax
Computes the maximum element
Computes the maximum byte
Computes the maximum element
Computes the maximum character
maximum stream returns the greatest element in stream or Nothing if the stream is empty. maximum consumes the entire stream.
ghci> is <- Streams.fromList [1, 2, 3]
ghci> Streams.maximum is
3
ghci> Streams.read is     -- The stream is now empty
Nothing
O(n) maximum returns the maximum value from a ByteString
O(n) maximum returns the maximum value from a ByteString This function will fuse. An exception will be thrown in the case of an empty ByteString.
The largest element of a non-empty structure.
O(n) maximum returns the maximum value from a Text, which must be non-empty. Subject to fusion.
O(n) Yield the maximum element of the vector. The vector may not be empty.

Examples

>>> import qualified Data.Vector as V

>>> V.maximum $ V.fromList [2.0, 1.0]
2.0
O(n) Yield the maximum element of the vector. The vector may not be empty.

Examples

>>> import qualified Data.Vector as V

>>> V.maximum $ V.fromList [2.0, 1.0]
2.0