import TyCon
import VarEnv
import Name ( localiseName )
-import Outputable
import Util ( notNull )
import Data.IORef ( readIORef )
\end{code}
-- See Note [Indexed data types]
mkCase env scrut bndr ty [(DEFAULT,_,rhs)]
| Just (tycon, tys) <- splitTyConApp_maybe (idType bndr)
- , [(subst, fam_inst)] <- lookupFamInstEnv (lc_fams env) tycon tys
+ , [(fam_inst, rep_tys)] <- lookupFamInstEnv (lc_fams env) tycon tys
= let
rep_tc = famInstTyCon fam_inst
- rep_tys = map (substTyVar subst) (tyConTyVars rep_tc)
bndr' = setIdType bndr (mkTyConApp rep_tc rep_tys)
Just co_tc = tyConFamilyCoercion_maybe rep_tc
co = mkTyConApp co_tc rep_tys
lookupLevel :: LibCaseEnv -> Id -> LibCaseLevel
lookupLevel env id
= case lookupVarEnv (lc_lvl_env env) id of
- Just lvl -> lc_lvl env
+ Just lvl -> lvl
Nothing -> topLevel
freeScruts :: LibCaseEnv