:: Monad m => m Bool -> m () -> m () -package:IfElse
Monadic version of when, taking the condition in the monad
Monadic version of unless, taking the condition in the monad
Like
when, but where the test can be monadic.
Like
unless, but where the test can be monadic.
Monadic version of
unless. Reverse of
whenM.
Conditionally don't execute the provided action.
>>> unlessM (pure False) $ putTextLn "No text :("
No text :(
>>> unlessM (pure True) $ putTextLn "Yes text :)"
Monadic version of
when. Conditionally executes the provided
action.
>>> 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
Run the second value if the first value returns
True
Run the second value if the first value returns
False
A monadic-conditional version of the
when guard.
A monadic-conditional version of the
unless guard.
Only perform the action if the predicate returns
True.
Since 0.9.2
Only perform the action if the predicate returns
False.
Since 0.9.2
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
when with a monadic predicate.
unless with a monadic predicate.
Variant of
when that takes a monadic action for the condition.
Variant of
unless that takes a monadic action for the
condition.
This is the
whenM operator, With it you can write
doesItExists ?> removeIt instead of
do {e <-
doesItExists; when e removeIt}. There's not
unlessM
version, so you have to use
not.
not <$> doesItExists ?> createIt
Execute an action repeatedly as long as the given boolean expression
returns True. The condition is evaluated before the loop body.
Discards results.
p --> x. If
p returns
True, execute the
ManageHook.
(-->) :: Monoid m => Query Bool -> Query m -> Query m -- a simpler type
A whenX/whenM that accepts a monoidal return value.
Run the action if the given monadic condition becomes
True.