X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FInst.lhs;h=f8630280bee2022a98b5870291741eaf176de9b0;hb=519e79eac7b8c0cdabccc70e0e9477d389c14c98;hp=2170d4ff7b3a2c888965cd1d47a8cbecf1c20f5a;hpb=dbe50b77059c7d55f909ba4c10ac03b8374f5b5e;p=ghc-hetmet.git diff --git a/compiler/typecheck/Inst.lhs b/compiler/typecheck/Inst.lhs index 2170d4f..f863028 100644 --- a/compiler/typecheck/Inst.lhs +++ b/compiler/typecheck/Inst.lhs @@ -61,6 +61,7 @@ import InstEnv import FunDeps import TcMType import TcType +import MkCore import Type import TypeRep import Class @@ -69,16 +70,13 @@ import Module import Coercion import HscTypes import CoreFVs -import DataCon import Id import Name import NameSet -import Literal import Var ( Var, TyVar ) import qualified Var import VarEnv import VarSet -import TysWiredIn import PrelNames import BasicTypes import SrcLoc @@ -89,8 +87,6 @@ import Util import Unique import Outputable import Data.List -import TypeRep -import Class import Control.Monad \end{code} @@ -141,10 +137,7 @@ mkImplicTy tvs givens wanteds -- The type of an implication constraint in mkForAllTys tvs $ mkPhiTy (map dictPred givens) $ - if isSingleton dict_wanteds then - instType (head dict_wanteds) - else - mkTupleTy Boxed (length dict_wanteds) (map instType dict_wanteds) + mkBigCoreTupTy (map instType dict_wanteds) dictPred :: Inst -> TcPredType dictPred (Dict {tci_pred = pred}) = pred @@ -392,7 +385,7 @@ mkPredName uniq loc pred_ty -- we use the outermost tycon of the lhs, if there is one, to -- improve readability of Core code baseOcc = case splitTyConApp_maybe ty of - Nothing -> mkOccName tcName "$" + Nothing -> mkTcOcc "$" Just (tc, _) -> getOccName tc \end{code} @@ -408,7 +401,7 @@ newMethodFromName :: InstOrigin -> BoxyRhoType -> Name -> TcM TcId newMethodFromName origin ty name = do id <- tcLookupId name -- Use tcLookupId not tcLookupGlobalId; the method is almost - -- always a class op, but with -fno-implicit-prelude GHC is + -- always a class op, but with -XNoImplicitPrelude GHC is -- meant to find whatever thing is in scope, and that may -- be an ordinary function. loc <- getInstLoc origin @@ -758,9 +751,7 @@ lookupSimpleInst (Method {tci_oid = id, tci_tys = tys, tci_theta = theta, tci_lo lookupSimpleInst (LitInst { tci_lit = lit@OverLit { ol_val = lit_val , ol_rebindable = rebindable } , tci_ty = ty, tci_loc = iloc}) -#ifdef DEBUG - | rebindable = panic "lookupSimpleInst" -- A LitInst invariant -#endif + | debugIsOn && rebindable = panic "lookupSimpleInst" -- A LitInst invariant | Just witness <- shortCutLit lit_val ty = do { let lit' = lit { ol_witness = witness, ol_type = ty } ; return (GenInst [] (L loc (HsOverLit lit'))) } @@ -871,7 +862,7 @@ tcGetInstEnvs = do { eps <- getEps; env <- getGblEnv; %* * %************************************************************************ -Suppose we are doing the -fno-implicit-prelude thing, and we encounter +Suppose we are doing the -XNoImplicitPrelude thing, and we encounter a do-expression. We have to find (>>) in the current environment, which is done by the rename. Then we have to check that it has the same type as Control.Monad.(>>). Or, more precisely, a compatible type. One 'customer' had