:: [a] -> Bool

Test whether a list is empty.
>>> null []
True

>>> null [1]
False

>>> null [1..]
False
A composition of not and null.
notNull []  == False
notNull [1] == True
\xs -> notNull xs == not (null xs)
A version specialized to lists to avoid errors such as taking null of Maybe [a] instead of [a]. Such errors are hard to detect, because the type of elements of the list is not constrained.
Test whether the structure is empty. The default implementation is Left-associative and lazy in both the initial element and the accumulator. Thus optimised for structures where the first element can be accessed in constant time. Structures where this is not the case should have a non-default implementation.

Examples

Basic usage:
>>> null []
True
>>> null [1]
False
null is expected to terminate even for infinite structures. The default implementation terminates provided the structure is bounded on the left (there is a leftmost element).
>>> null [1..]
False
Test whether the structure is empty. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.
The genericLength function is an overloaded version of length. In particular, instead of returning an Int, it returns any type which is an instance of Num. It is, however, less efficient than length.
>>> genericLength [1, 2, 3] :: Int
3

>>> genericLength [1, 2, 3] :: Float
3.0
Users should take care to pick a return type that is wide enough to contain the full length of the list. If the width is insufficient, the overflow behaviour will depend on the (+) implementation in the selected Num instance. The following example overflows because the actual list length of 200 lies outside of the Int8 range of -128..127.
>>> genericLength [1..200] :: Int8
-56
The genericLength function is an overloaded version of length. In particular, instead of returning an Int, it returns any type which is an instance of Num. It is, however, less efficient than length.
>>> genericLength [1, 2, 3] :: Int
3

>>> genericLength [1, 2, 3] :: Float
3.0
Composition of not and null
A closed term has no free variables.
>>> isClosed []
True
>>> isClosed [1,2,3]
False
Left associative length computation that is appropriate for types like Integer.
Right associative length computation that is appropriate for types like Peano number.
O(1) Test whether a vector is empty.
O(1) Test whether a vector is empty
Are all elements the same.
allSame [1,1,2] == False
allSame [1,1,1] == True
allSame [1]     == True
allSame []      == True
allSame (1:1:2:undefined) == False
\xs -> allSame xs == (length (nub xs) <= 1)
Is there any element which occurs more than once.
anySame [1,1,2] == True
anySame [1,2,3] == False
anySame (1:2:1:undefined) == True
anySame [] == False
\xs -> anySame xs == (length (nub xs) < length xs)
>>> allEqual "aab"
False

>>> allEqual "aaa"
True

>>> allEqual "aa"
True

>>> allEqual "a"
True

>>> allEqual ""
True
Check whether all elements in a list are distinct from each other. Assumes that the Eq instance stands for an equivalence relation. O(n²) in the worst case distinct xs == True.
Checks if all the elements in the list are equal. Assumes that the Eq instance stands for an equivalence relation. O(n).
Test if all elements of a list are equal; returns True for empty list.