- ; case lookupFamInstEnvExact instEnv tycon tys of
- Nothing -> famInstNotFound tycon tys
- Just famInst -> return $ famInstTyCon famInst
+ ; case lookupFamInstEnv instEnv tycon tys of
+ [(subst,fam_inst)] -> return (rep_tc, substTyVars subst (tyConTyVars rep_tc))
+ where -- NB: assumption is that (tyConTyVars rep_tc) is in
+ -- the domain of the substitution
+ rep_tc = famInstTyCon fam_inst
+
+ other -> famInstNotFound tycon tys other