Refactoring: mainly rename ic_env_tvs to ic_untch
[ghc-hetmet.git] / compiler / typecheck / TcSimplify.lhs
index 546d96e..d8be2d1 100644 (file)
@@ -185,7 +185,7 @@ simplifyInfer :: Bool                   -- Apply monomorphism restriction
                       TcEvBinds)    -- ... binding these evidence variables
 simplifyInfer apply_mr tau_tvs wanted
   | isEmptyBag wanted    -- Trivial case is quite common
-  = do { zonked_tau_tvs <- zonkTcTyVarsAndFV (varSetElems tau_tvs)
+  = do { zonked_tau_tvs <- zonkTcTyVarsAndFV tau_tvs
        ; gbl_tvs        <- tcGetGlobalTyVars        -- Already zonked
        ; qtvs <- zonkQuantifiedTyVars (varSetElems (zonked_tau_tvs `minusVarSet` gbl_tvs))
        ; return (qtvs, [], emptyTcEvBinds) }
@@ -202,7 +202,7 @@ simplifyInfer apply_mr tau_tvs wanted
               <- simplifyAsMuchAsPossible SimplInfer zonked_wanted
 
        ; gbl_tvs <- tcGetGlobalTyVars
-       ; zonked_tau_tvs <- zonkTcTyVarsAndFV (varSetElems tau_tvs)
+       ; zonked_tau_tvs <- zonkTcTyVarsAndFV tau_tvs
        ; zonked_simples <- mapBagM zonkWantedEvVar simple_wanted
        ; let qtvs = findQuantifiedTyVars apply_mr zonked_simples zonked_tau_tvs gbl_tvs
              (bound, free) | apply_mr  = (emptyBag, zonked_simples)
@@ -236,7 +236,7 @@ simplifyAsMuchAsPossible ctxt wanteds
               simplifyApproxLoop 0 wanteds
 
              -- Report any errors
-       ; mapBagM_ reportUnsolvedImplication unsolved_implics
+       ; reportUnsolved (emptyBag, unsolved_implics)
 
        ; let final_wanted_evvars = mapBag deCanonicaliseWanted unsolved_flats
        ; return (final_wanted_evvars, ev_binds) }
@@ -512,7 +512,7 @@ simplifyRule name tv_bndrs lhs_wanted rhs_wanted
        ; rhs_binds_var@(EvBindsVar evb_ref _)  <- newTcEvBinds
        ; loc        <- getCtLoc (RuleSkol name)
        ; rhs_binds1 <- simplifyCheck SimplCheck $ unitBag $ WcImplic $ 
-             Implic { ic_env_tvs = emptyVarSet   -- No untouchables
+             Implic { ic_untch = emptyVarSet     -- No untouchables
                    , ic_env = emptyNameEnv
                    , ic_skols = mkVarSet tv_bndrs
                    , ic_scoped = panic "emitImplication"
@@ -642,12 +642,12 @@ solveImplication :: InertSet     -- Given
 -- 
 -- Precondition: everything is zonked by now
 solveImplication inert 
-     imp@(Implic { ic_env_tvs = untch 
-                 , ic_binds   = ev_binds
-                 , ic_skols   = skols 
-                 , ic_given   = givens
+     imp@(Implic { ic_untch  = untch 
+                 , ic_binds  = ev_binds
+                 , ic_skols  = skols 
+                 , ic_given  = givens
                  , ic_wanted = wanteds
-                 , ic_loc = loc })
+                 , ic_loc    = loc })
   = nestImplicTcS ev_binds untch $
     do { traceTcS "solveImplication {" (ppr imp) 
 
@@ -676,7 +676,7 @@ floatEqualities :: TcTyVarSet -> [EvVar]
                 -> CanonicalCts -> (CanonicalCts, CanonicalCts)
 floatEqualities skols can_given wanteds
   | hasEqualities can_given = (emptyBag, wanteds)
-  | otherwise                 = partitionBag is_floatable wanteds
+  | otherwise               = partitionBag is_floatable wanteds
   where
     is_floatable :: CanonicalCt -> Bool
     is_floatable (CTyEqCan { cc_tyvar = tv, cc_rhs = ty })
@@ -787,7 +787,8 @@ defaultTyVar untch the_tv
   , not (the_tv `elemVarSet` untch)
   , not (k `eqKind` default_k)
   = do { (ev, better_ty) <- TcSMonad.newKindConstraint (mkTyVarTy the_tv) default_k
-       ; let loc = CtLoc TypeEqOrigin (getSrcSpan the_tv) [] -- Yuk
+       ; let loc = CtLoc DefaultOrigin (getSrcSpan the_tv) [] -- Yuk
+                          -- 'DefaultOrigin' is strictly the declaration, but it's convenient
              wanted_eq  = CTyEqCan { cc_id     = ev
                                    , cc_flavor = Wanted loc
                                    , cc_tyvar  = the_tv
@@ -816,7 +817,7 @@ findDefaultableGroups (ctxt, default_tys, (ovl_strings, extended_defaults))
   | otherwise = filter is_defaultable_group (equivClasses cmp_tv unaries)
   where 
     unaries     :: [(CanonicalCt, TcTyVar)]  -- (C tv) constraints
-    non_unaries :: [CanonicalCt]             -- *other* constraints
+    non_unaries :: [CanonicalCt]             -- and *other* constraints
     
     (unaries, non_unaries) = partitionWith find_unary (bagToList wanteds)
         -- Finds unary type-class constraints