X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcExpr.lhs;h=d9e25c359ebd6eee30223b608e1f2e834fc6bf7b;hp=e6ab82b2636a4765b478facf57835c98c64904fa;hb=bf40e268d916947786c56ec38db86190854a2d2c;hpb=e6d057711f4d6d6ff6342c39fa2b9e44d25447f1 diff --git a/compiler/typecheck/TcExpr.lhs b/compiler/typecheck/TcExpr.lhs index e6ab82b..d9e25c3 100644 --- a/compiler/typecheck/TcExpr.lhs +++ b/compiler/typecheck/TcExpr.lhs @@ -45,7 +45,7 @@ import TcType ( TcType, TcSigmaType, TcRhoType, TvSubst, mkTyVarTys, mkFunTys, tcMultiSplitSigmaTy, tcSplitFunTysN, tcSplitTyConApp_maybe, - isSigmaTy, mkFunTy, mkTyConApp, isLinearPred, + isSigmaTy, mkFunTy, mkTyConApp, exactTyVarsOfType, exactTyVarsOfTypes, zipTopTvSubst, zipOpenTvSubst, substTys, substTyVar ) @@ -796,19 +796,9 @@ instFun orig fun subst tv_theta_prs = do { co_fn <- instCall orig tys theta ; go False (HsWrap co_fn fun) prs } - -- Hack Alert (want_method_inst)! -- See Note [No method sharing] - -- If f :: (%x :: T) => Int -> Int - -- Then if we have two separate calls, (f 3, f 4), we cannot - -- make a method constraint that then gets shared, thus: - -- let m = f %x in (m 3, m 4) - -- because that loses the linearity of the constraint. - -- The simplest thing to do is never to construct a method constraint - -- in the first place that has a linear implicit parameter in it. - want_method_inst theta = not (null theta) -- Overloaded - && not (any isLinearPred theta) -- Not linear + want_method_inst theta = not (null theta) -- Overloaded && not opt_NoMethodSharing - -- See Note [No method sharing] below \end{code} Note [Multiple instantiation]