[commit: ghc] ghc-8.0: Minor code refactoring (2f78d98)
git at git.haskell.org
git at git.haskell.org
Thu Jan 14 12:17:57 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/2f78d980bedf294932ff5fbe9f27d2aaf45f425f/ghc
>---------------------------------------------------------------
commit 2f78d980bedf294932ff5fbe9f27d2aaf45f425f
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.
(cherry picked from commit c73333a1a1b6697e5ffa54fa1f3c96fe54bf42b4)
>---------------------------------------------------------------
2f78d980bedf294932ff5fbe9f27d2aaf45f425f
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 9a4a171..9ee7335 100644
--- a/compiler/typecheck/TcSplice.hs
+++ b/compiler/typecheck/TcSplice.hs
@@ -1399,9 +1399,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)
@@ -1415,8 +1412,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