whenm

Monadic version of when, taking the condition in the monad
Like when, but where the test can be monadic.
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
A monadic-conditional version of the when guard.
Only perform the action if the predicate returns True. Since 0.9.2
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.
A variant of when with a monadic predicate.
when with a monadic predicate.
Run the action if the given monadic condition becomes True.
Variant of when that takes a monadic action for the condition.
Like when, but return either Nothing if the predicate was False, or Just with the result of the computation.
whenMaybe True  (print 1) == fmap Just (print 1)
whenMaybe False (print 1) == pure Nothing
Like whenMaybe, but where the test can be monadic.
Sets a callback that gets invoked each time a Music finishes playing. Note: don't call other Mixer functions within this callback.
A whenX/whenM that accepts a monoidal return value.
whenmod has a similar form and behavior to every, but requires an additional number. It applies the function to the pattern when the remainder of the current loop number divided by the first parameter is greater or equal than the second parameter. For example, the following makes every other block of four loops twice as dense:
d1 $ whenmod 8 4 (density 2) (sound "bd sn kurt")
Like when, but return either Nothing if the predicate was False, of Just with the result of the computation.
whenMaybe True  (print 1) == fmap Just (print 1)
whenMaybe False (print 1) == pure Nothing
A tactic for dealing with keys present in both maps in merge or mergeA. A tactic of type WhenMatched f x y z is an abstract representation of a function of type Key -> x -> y -> f (Maybe z).