[commit: ghc] wip/T9858-typeable-ben: Make the generated GHC.Prim module import GHC.Tuple (108faf9)

git at git.haskell.org git at git.haskell.org
Fri Aug 28 14:22:26 UTC 2015


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

On branch  : wip/T9858-typeable-ben
Link       : http://ghc.haskell.org/trac/ghc/changeset/108faf9fdc0225aedde4af7fecd1df432220fee5/ghc

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

commit 108faf9fdc0225aedde4af7fecd1df432220fee5
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Aug 28 15:24:02 2015 +0100

    Make the generated GHC.Prim module import GHC.Tuple
    
    See Note [Import GHC.Tuple into GHC.Prim] in
      genprimopcode/Main.hs
    
    I think this has been a lurking bug for ages.  Lacking it, Haddock's
    invocation of GHC for the ghc-prim library says
    
      Checking module GHC.Prim...
      attempting to use module ‘GHC.Tuple’
         (libraries/ghc-prim/./GHC/Tuple.hs)
         which is not loaded


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

108faf9fdc0225aedde4af7fecd1df432220fee5
 utils/genprimopcode/Main.hs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs
index 2a5218e..3ab8ff8 100644
--- a/utils/genprimopcode/Main.hs
+++ b/utils/genprimopcode/Main.hs
@@ -262,6 +262,16 @@ gen_hs_source (Info defaults entries) =
     ++ "-}\n"
     ++ "import GHC.Types (Coercible)\n"
 
+    ++ "import GHC.Tuple ()\n"
+            -- Note [Import GHC.Tuple into GHC.Prim]
+            -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+            -- This expresses a dependency on GHC.Tuple, which we need
+            -- to ensure that GHC.Tuple is compiled first.  The generated
+            -- code in this module mentions '()', and that in turn tries
+            -- to ensure that its home module is loaded (for instances I think)
+            -- So it had better be there, when compiling with --make or Haddock.
+            -- It's more kosher anyway to be explicit about the dependency.
+
     ++ "default ()"  -- If we don't say this then the default type include Integer
                      -- so that runs off and loads modules that are not part of
                      -- pacakge ghc-prim at all.  And that in turn somehow ends up



More information about the ghc-commits mailing list