檢查可摺疊結構是否為空
如果在可摺疊結構 t a 中沒有元素 a 則 null 返回 True,如果有一個或多個 a 則返回 a。null 為 True 的結構的 length 為 0。
ghci> null []
True
ghci> null [14, 29]
False
ghci> null Nothing
True
ghci> null (Right 'a')
False
ghci> null ('x', 3)
False
null 被定義為等同於:
class Foldable t where
-- ...
null::t a -> Bool
null = foldr (\_ _ -> False) True