[commit: ghc] master: Re-export Word from Prelude (re #9531) (393b820)
git at git.haskell.org
git at git.haskell.org
Sun Aug 31 10:27:13 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/393b820233caa00e428affc28e090b496d181664/ghc
>---------------------------------------------------------------
commit 393b820233caa00e428affc28e090b496d181664
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Sun Aug 31 11:40:50 2014 +0200
Re-export Word from Prelude (re #9531)
The original proposal text can be found at
http://www.haskell.org/pipermail/libraries/2014-August/023491.html
The proposal passed with a clear majority, and was additionally
confirmed by the core libraries committee.
*Compatibility Note*
Only code that imports `Data.Word` for the sole purpose of using `Word`
*and* requires to be `-Werror`-clean (due to `-fwarn-unused-imports`)
is affected by this change.
In order to write warning-free forward/backward compatible against `base`,
a variant of the following CPP-based snippet can be used:
-- Starting with base>4.7.0 or GHC>7.8 Prelude re-exports 'Word'
-- The following is needed, if 'Word' is the *only* entity needed from Data.Word
#ifdef MIN_VERSION_base
# if !MIN_VERSION_base(4,7,1)
import Data.Word (Word)
# endif
-- no cabal_macros.h -- fallback to __GLASGOW_HASKELL__
#elif __GLASGOW_HASKELL__ < 709
import Data.Word (Word)
#endif
This also updates the haddock submodule in order to avoid a compile warning
>---------------------------------------------------------------
393b820233caa00e428affc28e090b496d181664
compiler/coreSyn/MkCore.lhs | 4 +++-
libraries/base/Prelude.hs | 2 +-
libraries/base/changelog.md | 2 ++
mk/validate-settings.mk | 3 +++
testsuite/tests/lib/integer/IntegerConversionRules.hs | 5 ++++-
testsuite/tests/numeric/should_run/T7014.hs | 6 +++++-
testsuite/tests/typecheck/should_fail/T5095.stderr | 2 +-
utils/haddock | 2 +-
8 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/compiler/coreSyn/MkCore.lhs b/compiler/coreSyn/MkCore.lhs
index 3ba8b1d..08c3eed 100644
--- a/compiler/coreSyn/MkCore.lhs
+++ b/compiler/coreSyn/MkCore.lhs
@@ -92,7 +92,9 @@ import DynFlags
import Data.Char ( ord )
import Data.List
import Data.Ord
-import Data.Word
+#if __GLASGOW_HASKELL__ < 709
+import Data.Word ( Word )
+#endif
infixl 4 `mkCoreApp`, `mkCoreApps`
\end{code}
diff --git a/libraries/base/Prelude.hs b/libraries/base/Prelude.hs
index 9b1119e..3a3cc4d 100644
--- a/libraries/base/Prelude.hs
+++ b/libraries/base/Prelude.hs
@@ -48,7 +48,7 @@ module Prelude (
-- *** Numeric types
Int, Integer, Float, Double,
- Rational,
+ Rational, Word,
-- *** Numeric type classes
Num((+), (-), (*), negate, abs, signum, fromInteger),
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index 28005f8..b976811 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -20,6 +20,8 @@
* Make `abs` and `signum` handle (-0.0) correctly per IEEE-754.
+ * Re-export `Data.Word.Word` from `Prelude`
+
## 4.7.0.1 *Jul 2014*
* Bundled with GHC 7.8.3
diff --git a/mk/validate-settings.mk b/mk/validate-settings.mk
index 4ccef07..bd3e3bc 100644
--- a/mk/validate-settings.mk
+++ b/mk/validate-settings.mk
@@ -96,6 +96,9 @@ libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-incomplete-patterns
# Temporarily turn off pointless-pragma warnings for containers
libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-pointless-pragmas
+# Temporarily turn off unused-imports warnings for containers
+libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
+
# bytestring has identities at the moment
libraries/bytestring_dist-install_EXTRA_HC_OPTS += -fno-warn-identities
diff --git a/testsuite/tests/lib/integer/IntegerConversionRules.hs b/testsuite/tests/lib/integer/IntegerConversionRules.hs
index cb5269f..56949e7 100644
--- a/testsuite/tests/lib/integer/IntegerConversionRules.hs
+++ b/testsuite/tests/lib/integer/IntegerConversionRules.hs
@@ -1,7 +1,10 @@
+{-# LANGUAGE CPP #-}
module IntegerConversionRules where
-import Data.Word
+#if __GLASGOW_HASKELL__ < 709
+import Data.Word (Word)
+#endif
f1 :: Int -> Double
f1 = fi
diff --git a/testsuite/tests/numeric/should_run/T7014.hs b/testsuite/tests/numeric/should_run/T7014.hs
index 8237538..222b33b 100644
--- a/testsuite/tests/numeric/should_run/T7014.hs
+++ b/testsuite/tests/numeric/should_run/T7014.hs
@@ -1,7 +1,11 @@
+{-# LANGUAGE CPP #-}
+
module Main where
import Data.Bits
-import Data.Word
+#if __GLASGOW_HASKELL__ < 705
+import Data.Word (Word)
+#endif
test_and1 :: Word -> Word
test_and1 x = x .&. 0
diff --git a/testsuite/tests/typecheck/should_fail/T5095.stderr b/testsuite/tests/typecheck/should_fail/T5095.stderr
index e8d2b71..55342cd 100644
--- a/testsuite/tests/typecheck/should_fail/T5095.stderr
+++ b/testsuite/tests/typecheck/should_fail/T5095.stderr
@@ -53,7 +53,7 @@ T5095.hs:9:11:
instance Eq Float -- Defined in ‘GHC.Classes’
instance Eq Int -- Defined in ‘GHC.Classes’
instance Eq Ordering -- Defined in ‘GHC.Classes’
- instance Eq GHC.Types.Word -- Defined in ‘GHC.Classes’
+ instance Eq Word -- Defined in ‘GHC.Classes’
instance Eq a => Eq [a] -- Defined in ‘GHC.Classes’
instance Eq Integer
-- Defined in ‘integer-gmp-0.5.1.0:GHC.Integer.Type’
diff --git a/utils/haddock b/utils/haddock
index b2a807d..eee52f6 160000
--- a/utils/haddock
+++ b/utils/haddock
@@ -1 +1 @@
-Subproject commit b2a807da55d197c648fd2df1f156f9862711d92b
+Subproject commit eee52f697233f99e23c1d8183511229fb93e3f3e
More information about the ghc-commits
mailing list