[commit: ghc] master: Move ($!) from Prelude into GHC.Base (b53c95f)
git at git.haskell.org
git at git.haskell.org
Sat Sep 13 10:02:41 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/b53c95fe621d3a66a82e6dad383e1c0c08f3871e/ghc
>---------------------------------------------------------------
commit b53c95fe621d3a66a82e6dad383e1c0c08f3871e
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Sat Sep 13 11:56:37 2014 +0200
Move ($!) from Prelude into GHC.Base
I don't see any reason why this needs to be in Prelude, where it makes
life harder to avoid import cycles involving Prelude. Ideally, the
`Prelude` module should only re-export entities from other modules, and
not define anything on its own.
So this moves `($!)` close to the definition of its `($)` cousin.
>---------------------------------------------------------------
b53c95fe621d3a66a82e6dad383e1c0c08f3871e
libraries/base/GHC/Base.lhs | 6 +++++-
libraries/base/Prelude.hs | 8 --------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/libraries/base/GHC/Base.lhs b/libraries/base/GHC/Base.lhs
index 3ee533d..9fe148e 100644
--- a/libraries/base/GHC/Base.lhs
+++ b/libraries/base/GHC/Base.lhs
@@ -121,7 +121,7 @@ infixr 9 .
infixr 5 ++
infixl 4 <$
infixl 1 >>, >>=
-infixr 0 $
+infixr 0 $, $!
infixl 4 <*>, <*, *>, <**>
@@ -841,6 +841,10 @@ flip f x y = f y x
($) :: (a -> b) -> a -> b
f $ x = f x
+-- | Strict (call-by-value) application, defined in terms of 'seq'.
+($!) :: (a -> b) -> a -> b
+f $! x = let !vx = x in f vx -- see #2273
+
-- | @'until' p f@ yields the result of applying @f@ until @p@ holds.
until :: (a -> Bool) -> (a -> a) -> a -> a
until p f = go
diff --git a/libraries/base/Prelude.hs b/libraries/base/Prelude.hs
index 12fe189..12a3d8f 100644
--- a/libraries/base/Prelude.hs
+++ b/libraries/base/Prelude.hs
@@ -151,14 +151,6 @@ import GHC.Real
import GHC.Float
import GHC.Show
-infixr 0 $!
-
--- -----------------------------------------------------------------------------
--- Miscellaneous functions
-
--- | Strict (call-by-value) application, defined in terms of 'seq'.
-($!) :: (a -> b) -> a -> b
-f $! x = let !vx = x in f vx -- see #2273
#ifdef __HADDOCK__
-- | The value of @'seq' a b@ is bottom if @a@ is bottom, and otherwise
More information about the ghc-commits
mailing list