:: Monad m => m Bool -> m () -> m ()
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
A if with no else for unit returning thunks. Returns the value of the
test.
IO lifted &&
IO lifted ||
Conditionally do the right action based on the truth value of the left
expression
unless the left side is true, perform the right action
unless the (monadic) left side is true, perform the right action
Bind the result of the last expression in an anaphoric when.
composition of >>= and >>?
composition of >>= and >>=?
Execute a monadic action so long as a monadic boolean returns true.
Negation of
whileM: execute an action so long as the boolean
returns false.
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.