Bool package:relude

Convenient commonly used and very helpful functions to work with Bool and also with monads.
Case analysis for the Bool type. bool f t p evaluates to f when p is False, and evaluates to t when p is True. This is equivalent to if p then t else f; that is, one can think of it as an if-then-else construct with its arguments reordered. @since base-4.7.0.0

Examples

Basic usage:
>>> bool "foo" "bar" True
"bar"

>>> bool "foo" "bar" False
"foo"
Confirm that bool f t p and if p then t else f are equivalent:
>>> let p = True; f = "bar"; t = "foo"

>>> bool f t p == if p then t else f
True

>>> let p = False

>>> bool f t p == if p then t else f
True