[project @ 2004-12-21 12:22:22 by simonpj]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcUnify.lhs
index 3163802..179a7db 100644 (file)
@@ -65,7 +65,7 @@ import Name           ( isSystemName, mkSysTvName )
 import ErrUtils                ( Message )
 import SrcLoc          ( noLoc )
 import BasicTypes      ( Arity )
-import Util            ( equalLength, notNull )
+import Util            ( notNull )
 import Outputable
 \end{code}
 
@@ -383,6 +383,9 @@ tcSubPat :: TcSigmaType             -- Pattern type signature
         -> TcM ()
 -- In patterns we insist on an exact match; hence no CoFn returned
 --     See Note [Pattern coercions] in TcPat
+-- However, we can't call unify directly, because both types might be
+-- polymorphic; hence the call to tcSub, followed by a check for
+-- the identity coercion
 
 tcSubPat sig_ty (Infer hole) 
   = do { sig_ty' <- zonkTcType sig_ty
@@ -700,12 +703,7 @@ uTys r1 _ (PredTy (ClassP c1 tys1)) r2 _ (PredTy (ClassP c2 tys2))
 uTys r1 _ (FunTy fun1 arg1) r2 _ (FunTy fun2 arg2)
   = uTys r1 fun1 fun1 r2 fun2 fun2     `thenM_`    uTys r1 arg1 arg1 r2 arg2 arg2
 
-       -- NewType constructors must match
-uTys r1 _ (NewTcApp tc1 tys1) r2 _ (NewTcApp tc2 tys2)
-  | tc1 == tc2 = unifyTauTyLists r1 tys1 r2 tys2
-       -- See Note [TyCon app]
-
-       -- Ordinary type constructors must match
+       -- Type constructors must match
 uTys r1 ps_ty1 (TyConApp con1 tys1) r2 ps_ty2 (TyConApp con2 tys2)
   | con1 == con2 = unifyTauTyLists r1 tys1 r2 tys2
        -- See Note [TyCon app]
@@ -983,7 +981,6 @@ okToUnifyWith tv ty
     ok (AppTy t1 t2)                   = ok t1 `and` ok t2
     ok (FunTy t1 t2)                   = ok t1 `and` ok t2
     ok (TyConApp _ ts)                 = oks ts
-    ok (NewTcApp _ ts)                 = oks ts
     ok (ForAllTy _ _)                  = Just NotMonoType
     ok (PredTy st)             = ok_st st
     ok (NoteTy (FTVNote _) t)   = ok t