#include "HsVersions.h"
-import HsSyn ( HsDecl(..), RuleDecl(..), RuleBndr(..), HsTyVarBndr(..) )
+import HsSyn ( HsDecl(..), RuleDecl(..), RuleBndr(..) )
import CoreSyn ( CoreRule(..) )
import RnHsSyn ( RenamedHsDecl )
import TcHsSyn ( TypecheckedRuleDecl, mkHsLet )
import TcSimplify ( tcSimplifyToDicts, tcSimplifyAndCheck )
import TcType ( zonkTcTypes, zonkTcTyVarToTyVar, newTyVarTy )
import TcIfaceSig ( tcCoreExpr, tcCoreLamBndrs, tcVar )
-import TcMonoType ( kcTyVarScope, kcHsSigType, tcHsSigType, newSigTyVars, checkSigTyVars )
+import TcMonoType ( kcHsSigType, tcHsSigType, tcTyVars, checkSigTyVars )
import TcExpr ( tcExpr )
-import TcEnv ( tcExtendLocalValEnv, newLocalId,
- tcExtendTyVarEnv
- )
+import TcEnv ( tcExtendLocalValEnv, tcExtendTyVarEnv )
import Inst ( LIE, emptyLIE, plusLIEs, instToId )
import Id ( idType, idName, mkVanillaId )
import VarSet
import Type ( tyVarsOfTypes, openTypeKind )
import Bag ( bagToList )
import Outputable
-import Util
\end{code}
\begin{code}
-tcRules :: [RenamedHsDecl] -> TcM s (LIE, [TypecheckedRuleDecl])
+tcRules :: [RenamedHsDecl] -> TcM (LIE, [TypecheckedRuleDecl])
tcRules decls = mapAndUnzipTc tcRule [rule | RuleD rule <- decls] `thenTc` \ (lies, rules) ->
returnTc (plusLIEs lies, rules)
newTyVarTy openTypeKind `thenNF_Tc` \ rule_ty ->
-- Deal with the tyvars mentioned in signatures
- -- Yuk to the UserTyVar
- kcTyVarScope (map UserTyVar sig_tvs)
- (mapTc_ kcHsSigType sig_tys) `thenTc` \ sig_tv_kinds ->
- newSigTyVars sig_tv_kinds `thenNF_Tc` \ sig_tyvars ->
- tcExtendTyVarEnv sig_tyvars (
+ tcTyVars sig_tvs (mapTc_ kcHsSigType sig_tys) `thenTc` \ sig_tyvars ->
+ tcExtendTyVarEnv sig_tyvars (
-- Ditto forall'd variables
mapNF_Tc new_id vars `thenNF_Tc` \ ids ->
tcExpr lhs rule_ty `thenTc` \ (lhs', lhs_lie) ->
tcExpr rhs rule_ty `thenTc` \ (rhs', rhs_lie) ->
- returnTc (ids, lhs', rhs', lhs_lie, rhs_lie)
- ) `thenTc` \ (ids, lhs', rhs', lhs_lie, rhs_lie) ->
+ returnTc (sig_tyvars, ids, lhs', rhs', lhs_lie, rhs_lie)
+ ) `thenTc` \ (sig_tyvars, ids, lhs', rhs', lhs_lie, rhs_lie) ->
-- Check that LHS has no overloading at all
tcSimplifyToDicts lhs_lie `thenTc` \ (lhs_dicts, lhs_binds) ->