[project @ 1996-06-05 06:44:31 by partain]
[ghc-hetmet.git] / ghc / compiler / typecheck / Unify.lhs
index ad979b7..77742f4 100644 (file)
@@ -11,10 +11,10 @@ updatable substitution).
 
 module Unify ( unifyTauTy, unifyTauTyList, unifyTauTyLists, unifyFunTy ) where
 
-import Ubiq
+IMP_Ubiq()
 
 -- friends: 
-import TcMonad
+import TcMonad hiding ( rnMtoTcM )
 import Type    ( GenType(..), typeKind, mkFunTy, getFunTy_maybe )
 import TyCon   ( TyCon, mkFunTyCon )
 import TyVar   ( GenTyVar(..), TyVar(..), tyVarKind )
@@ -229,15 +229,24 @@ uUnboundVar tv1@(TyVar uniq1 kind1 name1 box1)
     case (maybe_ty1, maybe_ty2) of
        (_, BoundTo ty2') -> uUnboundVar tv1 maybe_ty1 ty2' ty2'
 
-       (DontBind,DontBind) 
-                    -> failTc (unifyDontBindErr tv1 ps_ty2)
-
        (UnBound, _) |  kind2 `hasMoreBoxityInfo` kind1
                     -> tcWriteTyVar tv1 ty2            `thenNF_Tc_` returnTc ()
        
        (_, UnBound) |  kind1 `hasMoreBoxityInfo` kind2
                     -> tcWriteTyVar tv2 (TyVarTy tv1)  `thenNF_Tc_` returnTc ()
 
+-- TEMPORARY FIX
+--     (DontBind,DontBind) 
+--                  -> failTc (unifyDontBindErr tv1 ps_ty2)
+
+-- TEMPORARILY allow two type-sig variables to be bound together.
+-- See notes in tcCheckSigVars
+       (DontBind,DontBind) |  kind2 `hasMoreBoxityInfo` kind1
+                           -> tcWriteTyVar tv1 ty2             `thenNF_Tc_` returnTc ()
+       
+                           |  kind1 `hasMoreBoxityInfo` kind2
+                           -> tcWriteTyVar tv2 (TyVarTy tv1)   `thenNF_Tc_` returnTc ()
+
        other        -> failTc (unifyKindErr tv1 ps_ty2)
 
        -- Second one isn't a type variable
@@ -330,9 +339,9 @@ expectedFunErr ty sty
 
 unifyKindErr tyvar ty sty
   = ppHang (ppStr "Compiler bug: kind mis-match between")
-        4 (ppSep [ppr sty tyvar, ppLparen, ppr sty (tyVarKind tyvar), ppRparen,
+        4 (ppSep [ppCat [ppr sty tyvar, ppStr "::", ppr sty (tyVarKind tyvar)],
                   ppStr "and", 
-                  ppr sty ty, ppLparen, ppr sty (typeKind ty), ppRparen])
+                  ppCat [ppr sty ty, ppStr "::", ppr sty (typeKind ty)]])
 
 unifyDontBindErr tyvar ty sty
   = ppHang (ppStr "Couldn't match the *signature/existential* type variable")