tcFamInstDecl (L loc decl)
= -- Prime error recovery, set source location
tcFamInstDecl (L loc decl)
= -- Prime error recovery, set source location
; tc <- tcFamInstDecl1 decl
; checkValidTyCon tc -- Remember to check validity;
-- no recursion to worry about here
; tc <- tcFamInstDecl1 decl
; checkValidTyCon tc -- Remember to check validity;
-- no recursion to worry about here
; checkValidTypeInst t_typats t_rhs
-- (4) construct representation tycon
; rep_tc_name <- newFamInstTyConName tc_name loc
; buildSynTyCon rep_tc_name t_tvs (SynonymTyCon t_rhs)
; checkValidTypeInst t_typats t_rhs
-- (4) construct representation tycon
; rep_tc_name <- newFamInstTyConName tc_name loc
; buildSynTyCon rep_tc_name t_tvs (SynonymTyCon t_rhs)
= tcTyVarBndrs tvs $ \ tvs' -> do
{ traceTc (text "tcd1" <+> ppr tc_name)
; rhs_ty' <- tcHsKindedType rhs_ty
= tcTyVarBndrs tvs $ \ tvs' -> do
{ traceTc (text "tcd1" <+> ppr tc_name)
; rhs_ty' <- tcHsKindedType rhs_ty
-- Check that we don't use families without -XTypeFamilies
; checkTc idx_tys $ badFamInstDecl tc_name
-- Check that we don't use families without -XTypeFamilies
; checkTc idx_tys $ badFamInstDecl tc_name
= setSrcSpan (srcLocSpan (getSrcLoc con)) $
addErrCtxt (dataConCtxt con) $
do { checkTc (dataConTyCon con == tc) (badDataConTyCon con)
= setSrcSpan (srcLocSpan (getSrcLoc con)) $
addErrCtxt (dataConCtxt con) $
do { checkTc (dataConTyCon con == tc) (badDataConTyCon con)
; checkValidMonoType (dataConOrigResTy con)
-- Disallow MkT :: T (forall a. a->a)
-- Reason: it's really the argument of an equality constraint
; checkValidMonoType (dataConOrigResTy con)
-- Disallow MkT :: T (forall a. a->a)
-- Reason: it's really the argument of an equality constraint