[commit: ghc] wip/rae: Remove tcInfExpr (#9404) (c26714c)
git at git.haskell.org
git at git.haskell.org
Fri Aug 8 18:59:44 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/rae
Link : http://ghc.haskell.org/trac/ghc/changeset/c26714caf71bbf7c5f763b626fe10c5b52a35726/ghc
>---------------------------------------------------------------
commit c26714caf71bbf7c5f763b626fe10c5b52a35726
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date: Sun Aug 3 21:29:51 2014 -0400
Remove tcInfExpr (#9404)
It seems that tcInfExpr (a special case for inferring a type
without a known result type) is unnecessary. This removes it
in favor of using the main tcExpr exclusively.
>---------------------------------------------------------------
c26714caf71bbf7c5f763b626fe10c5b52a35726
compiler/typecheck/TcExpr.lhs | 26 +-------------------------
1 file changed, 1 insertion(+), 25 deletions(-)
diff --git a/compiler/typecheck/TcExpr.lhs b/compiler/typecheck/TcExpr.lhs
index 7e6c495..b23e622 100644
--- a/compiler/typecheck/TcExpr.lhs
+++ b/compiler/typecheck/TcExpr.lhs
@@ -125,16 +125,9 @@ tcInferRho expr = addErrCtxt (exprCtxt expr) (tcInferRhoNC expr)
tcInferRhoNC (L loc expr)
= setSrcSpan loc $
- do { (expr', rho) <- tcInfExpr expr
+ do { (expr', rho) <- tcInfer (tcExpr expr)
; return (L loc expr', rho) }
-tcInfExpr :: HsExpr Name -> TcM (HsExpr TcId, TcRhoType)
-tcInfExpr (HsVar f) = tcInferId f
-tcInfExpr (HsPar e) = do { (e', ty) <- tcInferRhoNC e
- ; return (HsPar e', ty) }
-tcInfExpr (HsApp e1 e2) = tcInferApp e1 [e2]
-tcInfExpr e = tcInfer (tcExpr e)
-
tcHole :: OccName -> TcRhoType -> TcM (HsExpr TcId)
tcHole occ res_ty
= do { ty <- newFlexiTyVarTy liftedTypeKind
@@ -937,23 +930,6 @@ mk_app_msg fun = sep [ ptext (sLit "The function") <+> quotes (ppr fun)
, ptext (sLit "is applied to")]
----------------
-tcInferApp :: LHsExpr Name -> [LHsExpr Name] -- Function and args
- -> TcM (HsExpr TcId, TcRhoType) -- Translated fun and args
-
-tcInferApp (L _ (HsPar e)) args = tcInferApp e args
-tcInferApp (L _ (HsApp e1 e2)) args = tcInferApp e1 (e2:args)
-tcInferApp fun args
- = -- Very like the tcApp version, except that there is
- -- no expected result type passed in
- do { (fun1, fun_tau) <- tcInferFun fun
- ; (co_fun, expected_arg_tys, actual_res_ty)
- <- matchExpectedFunTys (mk_app_msg fun) (length args) fun_tau
- ; args1 <- tcArgs fun args expected_arg_tys
- ; let fun2 = mkLHsWrapCo co_fun fun1
- app = foldl mkHsApp fun2 args1
- ; return (unLoc app, actual_res_ty) }
-
-----------------
tcInferFun :: LHsExpr Name -> TcM (LHsExpr TcId, TcRhoType)
-- Infer and instantiate the type of a function
tcInferFun (L loc (HsVar name))
More information about the ghc-commits
mailing list