[Git][ghc/ghc][master] Use clearer example variable names for bool eliminator
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Thu Sep 14 12:58:47 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
ec490578 by Ellie Hermaszewska at 2023-09-14T08:58:24-04:00
Use clearer example variable names for bool eliminator
- - - - -
1 changed file:
- libraries/base/Data/Bool.hs
Changes:
=====================================
libraries/base/Data/Bool.hs
=====================================
@@ -31,10 +31,10 @@ import GHC.Base
-- $setup
-- >>> import Prelude
--- | Case analysis for the 'Bool' type. @'bool' x y p@ evaluates to @x@
--- when @p@ is 'False', and evaluates to @y@ when @p@ is 'True'.
+-- | Case analysis for the 'Bool' type. @'bool' f t p@ evaluates to @f@
+-- when @p@ is 'False', and evaluates to @t@ when @p@ is 'True'.
--
--- This is equivalent to @if p then y else x@; that is, one can
+-- 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.
--
@@ -49,14 +49,14 @@ import GHC.Base
-- >>> bool "foo" "bar" False
-- "foo"
--
--- Confirm that @'bool' x y p@ and @if p then y else x@ are
+-- Confirm that @'bool' f t p@ and @if p then t else f@ are
-- equivalent:
--
--- >>> let p = True; x = "bar"; y = "foo"
--- >>> bool x y p == if p then y else x
+-- >>> let p = True; f = "bar"; t = "foo"
+-- >>> bool f t p == if p then t else f
-- True
-- >>> let p = False
--- >>> bool x y p == if p then y else x
+-- >>> bool f t p == if p then t else f
-- True
--
bool :: a -> a -> Bool -> a
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ec4905780e317cf571d4089adc0044f09a2b5a52
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ec4905780e317cf571d4089adc0044f09a2b5a52
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230914/a369c2d8/attachment-0001.html>
More information about the ghc-commits
mailing list