:: [a] -> Bool package:ghc-lib-parser

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
The genericLength function defined in base can't be specialised due to the NOINLINE pragma. It is also not strict in the accumulator, and strictGenericLength is not exported. See #25706 for why it is important to use a strict, specialised version.