substInteractiveContext :: InteractiveContext -> TvSubst -> InteractiveContext
substInteractiveContext ictxt@InteractiveContext{ ic_tythings = tts } subst
  | isEmptyTvSubst subst = ictxt
  | otherwise            = ictxt { ic_tythings = map subst_ty tts }
  where
    subst_ty (AnId id) = AnId $ id `setIdType` substTy subst (idType id)
    subst_ty tt        = tt
substInteractiveContext :: InteractiveContext -> TvSubst -> InteractiveContext
substInteractiveContext ictxt@InteractiveContext{ ic_tythings = tts } subst
  | isEmptyTvSubst subst = ictxt
  | otherwise            = ictxt { ic_tythings = map subst_ty tts }
  where
    subst_ty (AnId id) = AnId $ id `setIdType` substTy subst (idType id)
    subst_ty tt        = tt
substInteractiveContext ictxt@InteractiveContext{ ic_tythings = tts } subst
  | isEmptyTvSubst subst = ictxt
  | otherwise            = ictxt { ic_tythings = map subst_ty tts }
  where
    subst_ty (AnId id) = AnId $ id `setIdType` substTy subst (idType id)
    subst_ty tt        = tt