BSD-3-Clause licensed by Erik Hesselink, Jeroen Leeuwestein, Tom Lokhorst, Sebastiaan Visser
Maintained by Tom Lokhorst
This version can be pinned in stack with:bool-extras-0.4.0@sha256:4d46de500f0a86e9c87f19b300485bf8721bf6eced801a43ca122137fa177273,1689

Module documentation for 0.4.0

Depends on 1 package(full list with versions):
Used by 1 package in lts-8.5(full list with versions):

The bool function allows folding over boolean values.

This is comparable to the maybe or either functions on their respective types.

The bool function is a replacement for the build-in if then else-syntax. However, since it is a function, it can be partially applied and passed around to higher order functions, like so:

ghci> :m + Data.Bool.Extras
ghci> let yesOrNo = bool "no" "yes"
ghci> map yesOrNo [True, False, True]
["yes", "no", "yes"]

Note that the arguments to bool are in the opposite order of the if then else-syntax; First the false value, then the true value, and finally the boolean.