-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A typeclass to determine if a given value is null. -- -- A typeclass to determine if a given foldable type (or other) is empty -- ~ null ~ invalid. The definition is intentionally vague, to cover -- types from Either to Text and Sets. @package IsNull @version 0.3.0.0 -- | A typeclass to determine if a given value is null. -- -- Strongly inspired by mono-traversable but with a simpler goal: -- supporting IsNull and nested IsNull operations. -- -- While the isNull function is equivalent to (==) -- mempty for most of the instances, not all -- Foldables are monoids, and not all monoids -- mempty means null: -- -- -- -- The main use case for this package are boolean conditions, namely the -- if then else construct. -- -- Bugs, suggestions and comments are most welcomed! -- -- https://github.com/jcristovao/IsNull module Data.IsNull class IsNull a where isN = isNull notNull = not . isNull isNullN = all isNull notNullN = not . isNullN isNullM = liftM isNull isNullNM = liftM isNullN <\> a b = if isNull a then b else a isNull :: IsNull a => a -> Bool isN :: IsNull a => a -> Bool notNull :: IsNull a => a -> Bool isNullN :: (IsNull a, Foldable f) => f a -> Bool notNullN :: (IsNull a, Foldable f) => f a -> Bool isNullM :: (IsNull a, Monad m) => m a -> m Bool isNullNM :: (IsNull a, Monad m, Foldable f) => m (f a) -> m Bool (<\>) :: IsNull a => a -> a -> a