The bool-extras package
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.
Properties
| Versions | 0.2.0, 0.3.0 |
|---|---|
| Dependencies | base (≥3 & <5) |
| License | BSD3 |
| Author | Erik Hesselink, Jeroen Leeuwestein, Tom Lokhorst, Sebastiaan Visser |
| Maintainer | Tom Lokhorst <tom@lokhorst.eu> |
| Stability | Stable |
| Category | Data |
| Home page | http://tom.lokhorst.eu/bool-extras |
| Upload date | Mon Jun 15 21:58:34 UTC 2009 |
| Uploaded by | TomLokhorst |
| Built on | ghc-6.10, ghc-6.12, ghc-7.0 |
Modules
- Data
- Bool
Downloads
- bool-extras-0.3.0.tar.gz (Cabal source package)
- package description (included in the package)