Commit af97da87 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.

Fix check of rhs of type family instances (#2157)

parent 80fe09d7
...@@ -1681,8 +1681,7 @@ checkValidTypeInst typats rhs ...@@ -1681,8 +1681,7 @@ checkValidTypeInst typats rhs
; mapM_ checkTyFamFreeness typats ; mapM_ checkTyFamFreeness typats
-- the right-hand side is a tau type -- the right-hand side is a tau type
; checkTc (isTauTy rhs) $ ; checkValidMonoType rhs
polyTyErr rhs
-- we have a decidable instance unless otherwise permitted -- we have a decidable instance unless otherwise permitted
; undecidable_ok <- doptM Opt_UndecidableInstances ; undecidable_ok <- doptM Opt_UndecidableInstances
...@@ -1735,11 +1734,6 @@ tyFamInstInIndexErr ty ...@@ -1735,11 +1734,6 @@ tyFamInstInIndexErr ty
colon) 4 $ colon) 4 $
ppr ty 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 :: Type -> SDoc -> SDoc
famInstUndecErr ty msg famInstUndecErr ty msg
= sep [msg, = sep [msg,
......
...@@ -286,8 +286,7 @@ tcFamInstDecl1 (decl@TySynonym {tcdLName = L loc tc_name}) ...@@ -286,8 +286,7 @@ tcFamInstDecl1 (decl@TySynonym {tcdLName = L loc tc_name})
; t_typats <- mapM tcHsKindedType k_typats ; t_typats <- mapM tcHsKindedType k_typats
; t_rhs <- tcHsKindedType k_rhs ; t_rhs <- tcHsKindedType k_rhs
-- (3) check that -- (3) check the well-formedness of the instance
-- - check the well-formedness of the instance
; checkValidTypeInst t_typats t_rhs ; checkValidTypeInst t_typats t_rhs
-- (4) construct representation tycon -- (4) construct representation tycon
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment