[commit: ghc] master: Minor code refactoring (c73333a)

git at git.haskell.org git at git.haskell.org
Thu Jan 14 08:27:56 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c73333a1a1b6697e5ffa54fa1f3c96fe54bf42b4/ghc

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

commit c73333a1a1b6697e5ffa54fa1f3c96fe54bf42b4
Author: Jan Stolarek <jan.stolarek at p.lodz.pl>
Date:   Thu Jan 14 09:26:44 2016 +0100

    Minor code refactoring
    
    This moves let-bindings right next to their use site.


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

c73333a1a1b6697e5ffa54fa1f3c96fe54bf42b4
 compiler/typecheck/TcSplice.hs | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs
index 86bdbde..16c0883 100644
--- a/compiler/typecheck/TcSplice.hs
+++ b/compiler/typecheck/TcSplice.hs
@@ -1400,9 +1400,6 @@ reifyDataCon isGadtDataCon tys dc
 
        ; r_arg_tys <- reifyTypes (if isGadtDataCon then g_arg_tys else arg_tys)
 
-       ; let [r_a1, r_a2] = r_arg_tys
-             [s1,   s2]   = dcdBangs
-
        ; main_con <-
            if | not (null fields) && not isGadtDataCon ->
                   return $ TH.RecC name (zip3 (map reifyFieldLabel fields)
@@ -1416,8 +1413,10 @@ reifyDataCon isGadtDataCon tys dc
                 -- constructors can be declared infix.
                 -- See Note [Infix GADT constructors] in TcTyClsDecls.
               | dataConIsInfix dc && not isGadtDataCon ->
-                  ASSERT( length arg_tys == 2 )
-                  return $ TH.InfixC (s1,r_a1) name (s2,r_a2)
+                  ASSERT( length arg_tys == 2 ) do
+                  { let [r_a1, r_a2] = r_arg_tys
+                        [s1,   s2]   = dcdBangs
+                  ; return $ TH.InfixC (s1,r_a1) name (s2,r_a2) }
               | isGadtDataCon -> do
                   { res_ty <- reifyType g_res_ty
                   ; return $ TH.GadtC [name] (dcdBangs `zip` r_arg_tys) res_ty }



More information about the ghc-commits mailing list