The least element of a non-empty structure. This function is
equivalent to
foldr1 min, and its behavior on
structures with multiple largest elements depends on the relevant
implementation of
min. For the default implementation of
min (
min x y = if x <= y then x else y), structure
order is used as a tie-breaker: if there are multiple least elements,
the leftmost of them is chosen (this is equivalent to
minimumBy 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 minimum in faster than linear time.
Examples
Basic usage:
>>> minimum [1..10]
1
>>> minimum []
*** Exception: Prelude.minimum: empty list
>>> minimum Nothing
*** Exception: minimum: empty structure
WARNING: This function is partial for possibly-empty structures like
lists.