[commit: ghc] master: Comments only explaining the imports for GHC.Integer, GHC.Tuple (7817ec1)

git at git.haskell.org git at git.haskell.org
Wed Jun 11 19:57:15 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7817ec16d186a59f169202c930e211bda553777b/ghc

>---------------------------------------------------------------

commit 7817ec16d186a59f169202c930e211bda553777b
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Jun 10 17:57:37 2014 +0100

    Comments only explaining the imports for GHC.Integer, GHC.Tuple
    
    See Note [Depend on GHC.Integer]
        Note [Depend on GHC.Tuple]
    
    This came up when Joachim got an unexpected missing-dependency
    error when fiddling with Data.Coerce.


>---------------------------------------------------------------

7817ec16d186a59f169202c930e211bda553777b
 libraries/base/GHC/Base.lhs | 40 ++++++++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/libraries/base/GHC/Base.lhs b/libraries/base/GHC/Base.lhs
index 2236a14..5c362d4 100644
--- a/libraries/base/GHC/Base.lhs
+++ b/libraries/base/GHC/Base.lhs
@@ -114,14 +114,8 @@ import GHC.Prim
 import GHC.Err
 import {-# SOURCE #-} GHC.IO (failIO)
 
--- This is not strictly speaking required by this module, but is an
--- implicit dependency whenever () or tuples are mentioned, so adding it
--- as an import here helps to get the dependencies right in the new
--- build system.
-import GHC.Tuple ()
--- Likewise we need Integer when deriving things like Eq instances, and
--- this is a convenient place to force it to be built
-import GHC.Integer ()
+import GHC.Tuple ()     -- Note [Depend on GHC.Tuple]
+import GHC.Integer ()   -- Note [Depend on GHC.Integer]
 
 infixr 9  .
 infixr 5  ++
@@ -132,6 +126,36 @@ infixr 0  $
 default ()              -- Double isn't available yet
 \end{code}
 
+Note [Depend on GHC.Integer]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The Integer type is special because TidyPgm uses
+GHC.Integer.Type.mkInteger to construct Integer literal values
+Currently it reads the interface file whether or not the current
+module *has* any Integer literals, so it's important that
+GHC.Integer.Type (in patckage integer-gmp or integer-simple) is
+compiled before any other module.  (There's a hack in GHC to disable
+this for packages ghc-prim, integer-gmp, integer-simple, which aren't
+allowed to contain any Integer literals.)
+
+Likewise we implicitly need Integer when deriving things like Eq
+instances.
+
+The danger is that if the build system doesn't know about the dependency
+on Integer, it'll compile some base module before GHC.Integer.Type, 
+resulting in:
+  Failed to load interface for ‘GHC.Integer.Type’
+    There are files missing in the ‘integer-gmp’ package,
+
+Bottom line: we make GHC.Base depend on GHC.Integer; and everything
+else either depends on GHC.Base, or does not have NoImplicitPrelude
+(ane hence depends on Prelude).
+
+Note [Depend on GHC.Tuple]
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+Similarly, tuple syntax (or ()) creates an implicit dependency on
+GHC.Tuple, so we use the same ruse as for Integer --- see Note [Depend on
+GHC.Integer] --- to explain this to the build system.  We make GHC.Base
+depend on GHC.Tuple, and everything else depends on GHC.Base or Prelude.
 
 %*********************************************************
 %*                                                      *



More information about the ghc-commits mailing list