maximum -package:base
O(n) maximum returns the maximum value from a
ByteString An exception will be thrown in the case of an empty
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.
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 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
O(n) Yield the maximum element of the vector. The vector may
not be empty.
Examples
>>> import qualified Data.Vector.Storable as VS
>>> VS.maximum $ VS.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.Unboxed as VU
>>> VU.maximum $ VU.fromList [2.0, 1.0]
2.0
Get the maximum element of a monomorphic container.
Safe version of
maximumEx, only works on monomorphic containers
wrapped in a
NonNull.
Examples
> let xs = ncons 1 [2, 3 :: Int]
> maximum xs
3