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

git at git.haskell.org git at git.haskell.org
Sun Sep 13 04:19:59 UTC 2015


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

On branch  : wip/T9858-typeable-ben2
Link       : http://ghc.haskell.org/trac/ghc/changeset/fe4e32ca7491e49b891fff242b867f5ca176f2aa/ghc

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

commit fe4e32ca7491e49b891fff242b867f5ca176f2aa
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


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

fe4e32ca7491e49b891fff242b867f5ca176f2aa
 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