invokedwhether
invokedwhether is a higher‑order function found primarily in the functional‑programming language PureScript. It is designed to simplify conditional execution of side‑effecting actions by combining the concepts of “invoke” and “whether”. The function accepts three arguments: a Boolean predicate, a “then” action, and an “else” action. If the predicate evaluates to true, invokedwhether executes the “then” action; otherwise, it executes the “else” action. This pattern is useful in situations where plain conditional expressions would result in duplicated effectful code.
The signature of invokedwhen is
```
invokedwhether :: Boolean → (() → Effect a) → (() → Effect a) → Effect a
```
Because the actions are wrapped in zero‑argument lambda expressions, invokedwhether guarantees that only one of the
Typical applications include conditional logging, optional cleanup tasks, or choice of different data‑source functions based on
The function was introduced in PureScript version 0.14.0, and its design was influenced by similar constructs in