Data.Function.Compat
(&) :: a -> (a -> b) -> b #
applyWhen :: Bool -> (a -> a) -> a -> a Source #
applyWhen applies a function to a value if a condition is true, otherwise, it returns the value unchanged.
applyWhen
It is equivalent to flip (bool id).
flip (bool id)
flip
bool
id
Algebraic properties:
applyWhen True = id
True
applyWhen False f = id
False
Since: 4.18.0.0