[commit: ghc] wip/spj-tc-branch2: Comments and trivial refactoring (ff8b588)

git at git.haskell.org git at git.haskell.org
Fri Sep 30 15:17:41 UTC 2016


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

On branch  : wip/spj-tc-branch2
Link       : http://ghc.haskell.org/trac/ghc/changeset/ff8b588e81abe015bf23f1b75f9e8d5705b108c3/ghc

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

commit ff8b588e81abe015bf23f1b75f9e8d5705b108c3
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Sep 19 10:08:29 2016 +0100

    Comments and trivial refactoring


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

ff8b588e81abe015bf23f1b75f9e8d5705b108c3
 compiler/basicTypes/BasicTypes.hs |  2 +-
 compiler/hsSyn/HsBinds.hs         |  4 +++-
 compiler/simplCore/CoreMonad.hs   | 16 ----------------
 compiler/simplCore/SimplCore.hs   | 16 ++++++++++++++++
 compiler/typecheck/TcInstDcls.hs  |  6 +++---
 5 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs
index aab0528..d911a54 100644
--- a/compiler/basicTypes/BasicTypes.hs
+++ b/compiler/basicTypes/BasicTypes.hs
@@ -961,7 +961,7 @@ data InlinePragma            -- Note [InlinePragma]
                                      --   That is, inl_sat describes the number of *source-code*
                                      --   arguments the thing must be applied to.  We add on the
                                      --   number of implicit, dictionary arguments when making
-                                     --   the InlineRule, and don't look at inl_sat further
+                                     --   the Unfolding, and don't look at inl_sat further
 
       , inl_act    :: Activation     -- Says during which phases inlining is allowed
 
diff --git a/compiler/hsSyn/HsBinds.hs b/compiler/hsSyn/HsBinds.hs
index 236892e..4878592 100644
--- a/compiler/hsSyn/HsBinds.hs
+++ b/compiler/hsSyn/HsBinds.hs
@@ -593,6 +593,7 @@ ppr_monobind (AbsBinds { abs_tvs = tyvars, abs_ev_vars = dictvars
       pprLHsBinds val_binds
 ppr_monobind (AbsBindsSig { abs_tvs         = tyvars
                           , abs_ev_vars     = dictvars
+                          , abs_sig_export  = poly_id
                           , abs_sig_ev_bind = ev_bind
                           , abs_sig_bind    = bind })
   = sdocWithDynFlags $ \ dflags ->
@@ -600,7 +601,8 @@ ppr_monobind (AbsBindsSig { abs_tvs         = tyvars
       hang (text "AbsBindsSig" <+> brackets (interpp'SP tyvars)
                                <+> brackets (interpp'SP dictvars))
          2 $ braces $ vcat
-      [ text "Bind:"     <+> ppr bind
+      [ text "Exported type:" <+> pprBndr LetBind poly_id
+      , text "Bind:"     <+> ppr bind
       , text "Evidence:" <+> ppr ev_bind ]
     else
       ppr bind
diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs
index 853f5be..a386a28 100644
--- a/compiler/simplCore/CoreMonad.hs
+++ b/compiler/simplCore/CoreMonad.hs
@@ -238,22 +238,6 @@ runMaybe (Just x) f = f x
 runMaybe Nothing  _ = CoreDoNothing
 
 {-
-Note [RULEs enabled in SimplGently]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-RULES are enabled when doing "gentle" simplification.  Two reasons:
-
-  * We really want the class-op cancellation to happen:
-        op (df d1 d2) --> $cop3 d1 d2
-    because this breaks the mutual recursion between 'op' and 'df'
-
-  * I wanted the RULE
-        lift String ===> ...
-    to work in Template Haskell when simplifying
-    splices, so we get simpler code for literal strings
-
-But watch out: list fusion can prevent floating.  So use phase control
-to switch off those rules until after floating.
-
 
 ************************************************************************
 *                                                                      *
diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs
index 8bc0392..0af167e 100644
--- a/compiler/simplCore/SimplCore.hs
+++ b/compiler/simplCore/SimplCore.hs
@@ -367,6 +367,22 @@ addPluginPasses builtin_passes
 #endif
 
 {-
+Note [RULEs enabled in SimplGently]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+RULES are enabled when doing "gentle" simplification.  Two reasons:
+
+  * We really want the class-op cancellation to happen:
+        op (df d1 d2) --> $cop3 d1 d2
+    because this breaks the mutual recursion between 'op' and 'df'
+
+  * I wanted the RULE
+        lift String ===> ...
+    to work in Template Haskell when simplifying
+    splices, so we get simpler code for literal strings
+
+But watch out: list fusion can prevent floating.  So use phase control
+to switch off those rules until after floating.
+
 ************************************************************************
 *                                                                      *
                   The CoreToDo interpreter
diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs
index 96d7493..8bd5092 100644
--- a/compiler/typecheck/TcInstDcls.hs
+++ b/compiler/typecheck/TcInstDcls.hs
@@ -1316,15 +1316,15 @@ tcMethodBody clas tyvars dfun_ev_vars inst_tys
                        -- Substitute the local_meth_name for the binder
                        -- NB: the binding is always a FunBind
 
-       ; global_meth_id <- addInlinePrags global_meth_id prags
-       ; spec_prags     <- tcSpecPrags global_meth_id prags
-
             -- taking instance signature into account might change the type of
             -- the local_meth_id
        ; (meth_implic, ev_binds_var, tc_bind)
              <- checkInstConstraints $
                 tcMethodBodyHelp sig_fn sel_id local_meth_id (L bind_loc lm_bind)
 
+       ; global_meth_id <- addInlinePrags global_meth_id prags
+       ; spec_prags     <- tcSpecPrags global_meth_id prags
+
         ; let specs  = mk_meth_spec_prags global_meth_id spec_inst_prags spec_prags
               export = ABE { abe_poly      = global_meth_id
                            , abe_mono      = local_meth_id



More information about the ghc-commits mailing list