Support for using libffi to implement FFI calls in GHCi (#631)
[ghc-hetmet.git] / compiler / types / Unify.lhs
index 8ffee89..9ab60e7 100644 (file)
@@ -146,11 +146,12 @@ match :: MatchEnv -- For the most part this is pushed downwards
                        --      in-scope set of the RnEnv2
       -> Type -> Type  -- Template and target respectively
       -> Maybe TvSubstEnv
--- This matcher works on source types; that is, 
--- it respects NewTypes and PredType
+-- This matcher works on core types; that is, it ignores PredTypes
+-- Watch out if newtypes become transparent agin!
+--     this matcher must respect newtypes
 
-match menv subst ty1 ty2 | Just ty1' <- tcView ty1 = match menv subst ty1' ty2
-                        | Just ty2' <- tcView ty2 = match menv subst ty1 ty2'
+match menv subst ty1 ty2 | Just ty1' <- coreView ty1 = match menv subst ty1' ty2
+                        | Just ty2' <- coreView ty2 = match menv subst ty1 ty2'
 
 match menv subst (TyVarTy tv1) ty2
   | tv1' `elemVarSet` me_tmpls menv
@@ -160,7 +161,8 @@ match menv subst (TyVarTy tv1) ty2
            -> Nothing  -- Occurs check
            | otherwise 
            -> do { subst1 <- match_kind menv subst tv1 ty2
-                 ; return (extendVarEnv subst tv1' ty2) }
+                 ; return (extendVarEnv subst1 tv1' ty2) }
+                       -- Note [Matching kinds]
 
        Just ty1'       -- There is an existing binding; check whether ty2 matches it
            | tcEqTypeX (nukeRnEnvL rn_env) ty1' ty2