null -package:bytestring
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 a list is empty.
>>> null []
True
>>> null [1]
False
>>> null [1..]
False
O(1) Tests whether a
Text is empty or not.
Is the map empty?
Data.IntMap.null (empty) == True
Data.IntMap.null (singleton 1 'a') == False
Is the map empty?
Data.Map.null (empty) == True
Data.Map.null (singleton 1 'a') == False
Is this the empty sequence?
O(1) Test whether a vector is empty.
O(1) Test whether a vector is empty.
Check whether the vector is empty.
Check whether the vector is empty.
O(1) Test whether a vector is empty.
Check whether the vector is empty.
O(1) Test whether a vector is empty.
Check whether the vector is empty.
O(1) Test whether a vector is empty.
Check whether the vector is empty.
Return
True if this map is empty,
False
otherwise.
Return
True if this set is empty,
False
otherwise.
>>> HashSet.null HashSet.empty
True
>>> HashSet.null (HashSet.singleton 1)
False