[project @ 1997-08-25 22:28:37 by sof]
authorsof <unknown>
Mon, 25 Aug 1997 22:28:37 +0000 (22:28 +0000)
committersof <unknown>
Mon, 25 Aug 1997 22:28:37 +0000 (22:28 +0000)
new function: zonkSigTyVar

ghc/compiler/typecheck/TcType.lhs

index 0af7c44..a4b7474 100644 (file)
@@ -27,7 +27,7 @@ module TcType (
   tcInstType, tcInstSigType, tcInstTcType, tcInstSigTcType,
   tcInstTheta, tcInstId,
 
-  zonkTcTyVars,
+  zonkTcTyVars, zonkSigTyVar,
   zonkTcType,
   zonkTcTypeToType,
   zonkTcTyVar,
@@ -410,6 +410,16 @@ zonkTcTyVar tyvar
        BoundTo other               -> zonkTcType other
        other                       -> returnNF_Tc (TyVarTy tyvar)
 
+-- Signature type variables only get bound to each other,
+-- never to a type
+zonkSigTyVar :: TcTyVar s -> NF_TcM s (TcTyVar s)
+zonkSigTyVar tyvar 
+  = tcReadTyVar tyvar          `thenNF_Tc` \ maybe_ty ->
+    case maybe_ty of
+       BoundTo ty@(TyVarTy tyvar') -> returnNF_Tc tyvar'       -- tcReadTyVar never returns a bound tyvar
+       BoundTo other               -> panic "zonkSigTyVar"     -- Should only be bound to another tyvar
+       other                       -> returnNF_Tc tyvar
+
 zonkTcType :: TcType s -> NF_TcM s (TcType s)
 
 zonkTcType (TyVarTy tyvar) = zonkTcTyVar tyvar