:: Monad m => m Bool -> m () -> m () package:universum

Monadic version of unless.
>>> unlessM (pure False) $ putTextLn "No text :("
No text :(

>>> unlessM (pure True) $ putTextLn "Yes text :)"
Monadic version of when.
>>> whenM (pure False) $ putTextLn "No text :("

>>> whenM (pure True)  $ putTextLn "Yes text :)"
Yes text :)

>>> whenM (Just True) (pure ())
Just ()

>>> whenM (Just False) (pure ())
Just ()

>>> whenM Nothing (pure ())
Nothing
Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages. 'as >> bs' can be understood as the do expression
do as
bs