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

git at git.haskell.org git at git.haskell.org
Tue Sep 20 20:48:38 UTC 2016


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

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

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

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

    Comments and trivial refactoring


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

c30773ce53714980594a5fa2b8a0e6f5547b3c4d
 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 +++---
 compiler/types/TyCoRep.hs         |  2 +-
 6 files changed, 24 insertions(+), 22 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 572b3f1..ab91c84 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
diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index cd221a2..88352e9 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -1686,7 +1686,7 @@ the range of the TvSubstEnv should *never* include a type headed with
 CoercionTy.
 
 Note [The substitution invariant]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 When calling (substTy subst ty) it should be the case that
 the in-scope set in the substitution is a superset of both:
 



More information about the ghc-commits mailing list