null
returns True
if there are no elements a
in a foldable structure t a
, and False
if there is one or more. Structures for which null
is True
have a length
of 0.
ghci> null []
True
ghci> null [14, 29]
False
ghci> null Nothing
True
ghci> null (Right 'a')
False
ghci> null ('x', 3)
False
null
is defined as being equivalent to:
class Foldable t where
-- ...
null :: t a -> Bool
null = foldr (\_ _ -> False) True