not package:relude

Boolean "not"
Inverse of member function.
>>> let myHashMap = HashMap.fromList [('a', "xxx"), ('b', "yyy")]

>>> notMember 'b' myHashMap
False
>>> notMember 'c' myHashMap
True
Like notElem but doesn't work on Set and HashSet for performance reasons.
>>> notElem 'x' ("abc" :: String)
True

>>> notElem False (one True :: Set Bool)
...
... Do not use 'elem' and 'notElem' methods from 'Foldable' on Set
Suggestions:
Instead of
elem :: (Foldable t, Eq a) => a -> t a -> Bool
use
member :: Ord a => a -> Set a -> Bool
...
Instead of
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
use
not . member
...
Performs given action over NonEmpty list if given list is non empty.
>>> whenNotNull [] $ \(b :| _) -> print (not b)

>>> whenNotNull [False,True] $ \(b :| _) -> print (not b)
True
Monadic version of whenNotNull.
Performs default Applicative action if Nothing is given. Otherwise returns content of Just pured to Applicative.
>>> whenNothing Nothing [True, False]
[True,False]

>>> whenNothing (Just True) [True, False]
[True]
Monadic version of whenNothing.
>>> whenNothingM (pure $ Just True) $ True <$ putTextLn "Is Just!"
True

>>> whenNothingM (pure Nothing) $ False <$ putTextLn "Is Nothing!"
Is Nothing!
False
Monadic version of whenNothing_.
>>> whenNothingM_ (pure $ Just True) $ putTextLn "Is Just!"

>>> whenNothingM_ (pure Nothing) $ putTextLn "Is Nothing!"
Is Nothing!
Performs default Applicative action if Nothing is given. Do nothing for Just. Convenient for discarding Just content.
>>> whenNothing_ Nothing $ putTextLn "Nothing!"
Nothing!

>>> whenNothing_ (Just True) $ putTextLn "Nothing!"
The isNothing function returns True iff its argument is Nothing.

Examples

Basic usage:
>>> isNothing (Just 3)
False
>>> isNothing (Just ())
False
>>> isNothing Nothing
True
Only the outer constructor is taken into consideration:
>>> isNothing (Just Nothing)
False