| Copyright | (c) The University of Glasgow 2001 |
|---|---|
| License | BSD-style (see the file libraries/base/LICENSE) |
| Maintainer | libraries@haskell.org |
| Stability | stable |
| Portability | portable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
GHC.Internal.Data.Bool
Contents
Description
The Bool type and related functions.
Booleans
Instances
Operations
bool :: a -> a -> Bool -> a Source #
Case analysis for the Bool type. evaluates to bool f t pf
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.
Examples
Basic usage:
>>>bool "foo" "bar" True"bar">>>bool "foo" "bar" False"foo"
Confirm that and bool f t pif p then t else f are
equivalent:
>>>let p = True; f = "bar"; t = "foo">>>bool f t p == if p then t else fTrue>>>let p = False>>>bool f t p == if p then t else fTrue
Since: base-4.7.0.0