Fix check of rhs of type family instances (#2157)
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>
Mon, 14 Jul 2008 09:45:24 +0000 (09:45 +0000)
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>
Mon, 14 Jul 2008 09:45:24 +0000 (09:45 +0000)
compiler/typecheck/TcMType.lhs
compiler/typecheck/TcTyClsDecls.lhs

index ecdf59f..fc620ec 100644 (file)
@@ -1681,8 +1681,7 @@ checkValidTypeInst typats rhs
        ; mapM_ checkTyFamFreeness typats
 
          -- the right-hand side is a tau type
-       ; checkTc (isTauTy rhs) $ 
-          polyTyErr rhs
+       ; checkValidMonoType rhs
 
          -- we have a decidable instance unless otherwise permitted
        ; undecidable_ok <- doptM Opt_UndecidableInstances
@@ -1735,11 +1734,6 @@ tyFamInstInIndexErr ty
          colon) 4 $
       ppr ty
 
-polyTyErr :: Type -> SDoc
-polyTyErr ty 
-  = hang (ptext (sLit "Illegal polymorphic type in type instance") <> colon) 4 $
-      ppr ty
-
 famInstUndecErr :: Type -> SDoc -> SDoc
 famInstUndecErr ty msg 
   = sep [msg, 
index 635fef9..4a2a289 100644 (file)
@@ -286,8 +286,7 @@ tcFamInstDecl1 (decl@TySynonym {tcdLName = L loc tc_name})
        ; t_typats <- mapM tcHsKindedType k_typats
        ; t_rhs    <- tcHsKindedType k_rhs
 
-         -- (3) check that 
-         --     - check the well-formedness of the instance
+         -- (3) check the well-formedness of the instance
        ; checkValidTypeInst t_typats t_rhs
 
          -- (4) construct representation tycon