bool-extras: A fold function for Bool
This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.
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, 0.4.0, 0.4.0 |
---|---|
Change log | None available |
Dependencies | base (>=3 && <5) [details] |
License | BSD-3-Clause |
Author | Erik Hesselink, Jeroen Leeuwestein, Tom Lokhorst, Sebastiaan Visser |
Maintainer | Tom Lokhorst <tom@lokhorst.eu> |
Category | Data |
Home page | http://tom.lokhorst.eu/bool-extras |
Uploaded | by TomLokhorst at 2014-04-04T12:58:22Z |
Modules
[Index]
- Data
- Bool
Downloads
- bool-extras-0.4.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
Package maintainers
For package maintainers and hackage trustees