minimum

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.
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).
>>> minimum (32 :| [64, 8, 128, 16])
8
minimum returns the minimum value from a list, which must be non-empty, finite, and of an ordered type. This function is equivalent to foldr1 min, and its behavior on lists with multiple minima depends on the relevant implementation of min. For the default implementation of min, list order is used as a tie-breaker: if there are multiple minima, the leftmost of them is chosen (this is equivalent to minimumBy compare).
>>> minimum []
*** Exception: Prelude.minimum: empty list

>>> minimum [42]
42

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

>>> minimum [1..]
* Hangs forever *
O(n) minimum returns the minimum value from a ByteString An exception will be thrown in the case of an empty ByteString.
minimum returns the minimum value from a ByteString
O(n) minimum returns the minimum value from a ByteString
O(n) minimum returns the minimum value from a Text, which must be non-empty.
O(n) minimum returns the minimum value from a Text, which must be non-empty. Properties
minimum . stream = minimum
The least element of a non-empty structure with respect to the given comparison function. Structure order is used as a tie-breaker: if there are multiple least elements, the leftmost of them is chosen.

Examples

Basic usage:
>>> minimumBy (compare `on` length) ["Hello", "World", "!", "Longest", "bar"]
"!"
WARNING: This function is partial for possibly-empty structures like lists.
The least element of a non-empty structure with respect to the given comparison function. Structure order is used as a tie-breaker: if there are multiple least elements, the leftmost of them is chosen.
The least element of a non-empty structure. This function is equivalent to bifoldr1 min, and its behavior on structures with multiple least 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 biminimumBy compare).

Examples

Basic usage:
>>> biminimum (42, 17)
17
>>> biminimum (Right 42)
42
>>> biminimum (BiList [13, 29, 4] [18, 1, 7])
1
>>> biminimum (BiList [13, 29, 4] [])
4
On empty structures, this function throws an exception:
>>> biminimum (BiList [] [])
*** Exception: biminimum: empty structure
...
The least element of a non-empty structure with respect to the given comparison function. Structure order is used as a tie-breaker: if there are multiple least elements, the leftmost of them is chosen.

Examples

Basic usage:
>>> biminimumBy compare (42, 17)
17
>>> biminimumBy compare (Left 17)
17
>>> biminimumBy compare (BiList [42, 17, 23] [-5, 18])
-5
On empty structures, this function throws an exception:
>>> biminimumBy compare (BiList [] [])
*** Exception: bifoldr1: empty structure
...