#include "HsVersions.h"
-import Type ( pprParendType )
import Var ( Var, TyVar, tyVarKind )
import VarEnv
import VarSet
Now the internals of matching
\begin{code}
-match :: MatchEnv -- For the ost part this is pushed downwards
+match :: MatchEnv -- For the most part this is pushed downwards
-> TvSubstEnv -- Substitution so far:
-- Domain is subset of template tyvars
-- Free vars of range is subset of
= case lookupVarEnv subst tv1' of
Nothing | any (inRnEnvR rn_env) (varSetElems (tyVarsOfType ty2))
-> Nothing -- Occurs check
+ | not (typeKind ty2 `isSubKind` tyVarKind tv1)
+ -> Nothing -- Kind mis-match
| otherwise
-> Just (extendVarEnv subst tv1 ty2)