summaryrefslogtreecommitdiff
path: root/libraries/base/Data/Bool.hs
diff options
context:
space:
mode:
authorOliver Charles <ollie@ocharles.org.uk>2013-09-15 01:23:56 +0100
committerJoachim Breitner <mail@joachim-breitner.de>2013-09-16 17:04:20 +0200
commit907cd8c36b6c249dcb8af19f05303e34eb4e8de4 (patch)
tree22b8026a2c5d34ad40fc6db58c072b2537acdd79 /libraries/base/Data/Bool.hs
parentacaa1c873d6d0657b8b918f8d38927d5667329ac (diff)
downloadhaskell-907cd8c36b6c249dcb8af19f05303e34eb4e8de4.tar.gz
Add Data.Bool.bool (fixes #8302)
Diffstat (limited to 'libraries/base/Data/Bool.hs')
-rw-r--r--libraries/base/Data/Bool.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/libraries/base/Data/Bool.hs b/libraries/base/Data/Bool.hs
index 2f80c97167..9f6ce04ad0 100644
--- a/libraries/base/Data/Bool.hs
+++ b/libraries/base/Data/Bool.hs
@@ -23,9 +23,16 @@ module Data.Bool (
(||),
not,
otherwise,
+ bool,
) where
#ifdef __GLASGOW_HASKELL__
import GHC.Base
#endif
+-- | Case analysis for the 'Bool' type.
+-- @bool a b p@ evaluates to @a@ when @p@ is @False@, and evaluates to @b@
+-- when @p@ is @True@.
+bool :: a -> a -> Bool -> a
+bool f _ False = f
+bool _ t True = t