[commit: ghc] wip/T9858-typeable-ben2: Clean up types of mkWeak# (07dae12)

git at git.haskell.org git at git.haskell.org
Tue Sep 22 14:47:34 UTC 2015


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

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

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

commit 07dae12cdff170a366bb56945720337b96b44538
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Fri Sep 18 17:54:22 2015 +0200

    Clean up types of mkWeak#
    
    Previously the types needlessly used (), which is defined ghc-prim,
    leading to unfortunate import cycles. See #10867 for details.


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

07dae12cdff170a366bb56945720337b96b44538
 compiler/prelude/primops.txt.pp |  6 +++---
 libraries/base/GHC/Weak.hs      |  2 +-
 utils/genprimopcode/Main.hs     | 10 ----------
 3 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 5fe02b2..af5e0c9 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -2081,7 +2081,7 @@ primop  CatchSTMOp "catchSTM#" GenPrimOp
 
 primop  Check "check#" GenPrimOp
       (State# RealWorld -> (# State# RealWorld, a #) )
-   -> (State# RealWorld -> (# State# RealWorld, () #) )
+   -> (State# RealWorld -> State# RealWorld)
    with
    out_of_line = True
    has_side_effects = True
@@ -2332,7 +2332,7 @@ primtype Weak# b
 -- note that tyvar "o" denotes openAlphaTyVar
 
 primop  MkWeakOp "mkWeak#" GenPrimOp
-   o -> b -> c -> State# RealWorld -> (# State# RealWorld, Weak# b #)
+   a -> b -> (State# RealWorld -> State# RealWorld) -> (# State# RealWorld, Weak# b #)
    with
    has_side_effects = True
    out_of_line      = True
@@ -2364,7 +2364,7 @@ primop  DeRefWeakOp "deRefWeak#" GenPrimOp
 
 primop  FinalizeWeakOp "finalizeWeak#" GenPrimOp
    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#,
-              (State# RealWorld -> (# State# RealWorld, () #)) #)
+              (State# RealWorld -> State# RealWorld) #)
    with
    has_side_effects = True
    out_of_line      = True
diff --git a/libraries/base/GHC/Weak.hs b/libraries/base/GHC/Weak.hs
index 6d4d80e..9434bd9 100644
--- a/libraries/base/GHC/Weak.hs
+++ b/libraries/base/GHC/Weak.hs
@@ -141,7 +141,7 @@ Instance Eq (Weak v) where
 -- the IO primitives are inlined by hand here to get the optimal
 -- code (sigh) --SDM.
 
-runFinalizerBatch :: Int -> Array# (IO ()) -> IO ()
+runFinalizerBatch :: Int -> Array# (State# RealWorld -> State# RealWorld) -> IO ()
 runFinalizerBatch (I# n) arr =
    let  go m  = IO $ \s ->
                   case m of
diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs
index 3ab8ff8..2a5218e 100644
--- a/utils/genprimopcode/Main.hs
+++ b/utils/genprimopcode/Main.hs
@@ -262,16 +262,6 @@ 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