summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Core')
-rw-r--r--compiler/GHC/Core/Coercion.hs14
-rw-r--r--compiler/GHC/Core/Coercion/Opt.hs14
-rw-r--r--compiler/GHC/Core/Lint.hs8
-rw-r--r--compiler/GHC/Core/Opt/Arity.hs6
-rw-r--r--compiler/GHC/Core/Opt/ConstantFold.hs2
-rw-r--r--compiler/GHC/Core/Opt/Simplify/Utils.hs2
-rw-r--r--compiler/GHC/Core/Opt/SpecConstr.hs2
-rw-r--r--compiler/GHC/Core/Opt/WorkWrap/Utils.hs4
-rw-r--r--compiler/GHC/Core/Predicate.hs2
-rw-r--r--compiler/GHC/Core/TyCo/Ppr.hs8
-rw-r--r--compiler/GHC/Core/TyCo/Tidy.hs8
-rw-r--r--compiler/GHC/Core/Type.hs74
12 files changed, 72 insertions, 72 deletions
diff --git a/compiler/GHC/Core/Coercion.hs b/compiler/GHC/Core/Coercion.hs
index 16d8f427e9..4413c7355b 100644
--- a/compiler/GHC/Core/Coercion.hs
+++ b/compiler/GHC/Core/Coercion.hs
@@ -427,8 +427,8 @@ decomposePiCos orig_co (Pair orig_k1 orig_k2) orig_args
-- Invariant: co :: subst1(k2) ~ subst2(k2)
go acc_arg_cos (subst1,k1) co (subst2,k2) (ty:tys)
- | Just (a, t1) <- splitForAllTy_maybe k1
- , Just (b, t2) <- splitForAllTy_maybe k2
+ | Just (a, t1) <- splitForAllTyCoVar_maybe k1
+ , Just (b, t2) <- splitForAllTyCoVar_maybe k2
-- know co :: (forall a:s1.t1) ~ (forall b:s2.t2)
-- function :: forall a:s1.t1 (the function is not passed to decomposePiCos)
-- a :: s1
@@ -1029,7 +1029,7 @@ mkNthCo r n co
go r 0 co
| Just (ty, _) <- isReflCo_maybe co
- , Just (tv, _) <- splitForAllTy_maybe ty
+ , Just (tv, _) <- splitForAllTyCoVar_maybe ty
= -- works for both tyvar and covar
ASSERT( r == Nominal )
mkNomReflCo (varType tv)
@@ -1080,8 +1080,8 @@ mkNthCo r n co
good_call
-- If the Coercion passed in is between forall-types, then the Int must
-- be 0 and the role must be Nominal.
- | Just (_tv1, _) <- splitForAllTy_maybe ty1
- , Just (_tv2, _) <- splitForAllTy_maybe ty2
+ | Just (_tv1, _) <- splitForAllTyCoVar_maybe ty1
+ , Just (_tv2, _) <- splitForAllTyCoVar_maybe ty2
= n == 0 && r == Nominal
-- If the Coercion passed in is between T tys and T tys', then the Int
@@ -1140,7 +1140,7 @@ nthCoRole n co
| Just (tc, _) <- splitTyConApp_maybe lty
= nthRole r tc n
- | Just _ <- splitForAllTy_maybe lty
+ | Just _ <- splitForAllTyCoVar_maybe lty
= Nominal
| otherwise
@@ -2330,7 +2330,7 @@ go_nth d ty
args `getNth` d
| d == 0
- , Just (tv,_) <- splitForAllTy_maybe ty
+ , Just (tv,_) <- splitForAllTyCoVar_maybe ty
= tyVarKind tv
| otherwise
diff --git a/compiler/GHC/Core/Coercion/Opt.hs b/compiler/GHC/Core/Coercion/Opt.hs
index fb0a6b0cc0..76ffde9c4d 100644
--- a/compiler/GHC/Core/Coercion/Opt.hs
+++ b/compiler/GHC/Core/Coercion/Opt.hs
@@ -335,7 +335,7 @@ opt_co4 env _sym rep r (NthCo _r n co)
| Just (ty, _) <- isReflCo_maybe co
, n == 0
- , Just (tv, _) <- splitForAllTy_maybe ty
+ , Just (tv, _) <- splitForAllTyCoVar_maybe ty
-- works for both tyvar and covar
= liftCoSubst (chooseRole rep r) env (varType tv)
@@ -531,8 +531,8 @@ opt_univ env sym prov role oty1 oty2
-- can't optimize the AppTy case because we can't build the kind coercions.
- | Just (tv1, ty1) <- splitForAllTy_ty_maybe oty1
- , Just (tv2, ty2) <- splitForAllTy_ty_maybe oty2
+ | Just (tv1, ty1) <- splitForAllTyVar_maybe oty1
+ , Just (tv2, ty2) <- splitForAllTyVar_maybe oty2
-- NB: prov isn't interesting here either
= let k1 = tyVarKind tv1
k2 = tyVarKind tv2
@@ -544,8 +544,8 @@ opt_univ env sym prov role oty1 oty2
in
mkForAllCo tv1' eta' (opt_univ env' sym prov' role ty1 ty2')
- | Just (cv1, ty1) <- splitForAllTy_co_maybe oty1
- , Just (cv2, ty2) <- splitForAllTy_co_maybe oty2
+ | Just (cv1, ty1) <- splitForAllCoVar_maybe oty1
+ , Just (cv2, ty2) <- splitForAllCoVar_maybe oty2
-- NB: prov isn't interesting here either
= let k1 = varType cv1
k2 = varType cv2
@@ -1121,7 +1121,7 @@ etaForAllCo_ty_maybe co
= Just (tv, kind_co, r)
| Pair ty1 ty2 <- coercionKind co
- , Just (tv1, _) <- splitForAllTy_ty_maybe ty1
+ , Just (tv1, _) <- splitForAllTyVar_maybe ty1
, isForAllTy_ty ty2
, let kind_co = mkNthCo Nominal 0 co
= Just ( tv1, kind_co
@@ -1137,7 +1137,7 @@ etaForAllCo_co_maybe co
= Just (cv, kind_co, r)
| Pair ty1 ty2 <- coercionKind co
- , Just (cv1, _) <- splitForAllTy_co_maybe ty1
+ , Just (cv1, _) <- splitForAllCoVar_maybe ty1
, isForAllTy_co ty2
= let kind_co = mkNthCo Nominal 0 co
r = coVarRole cv1
diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs
index a61b788dc9..4dc3ec0abe 100644
--- a/compiler/GHC/Core/Lint.hs
+++ b/compiler/GHC/Core/Lint.hs
@@ -1240,7 +1240,7 @@ checkCaseLinearity ue case_bndr var_w bndr = do
-----------------
lintTyApp :: LintedType -> LintedType -> LintM LintedType
lintTyApp fun_ty arg_ty
- | Just (tv,body_ty) <- splitForAllTy_maybe fun_ty
+ | Just (tv,body_ty) <- splitForAllTyCoVar_maybe fun_ty
= do { lintTyKind tv arg_ty
; in_scope <- getInScope
-- substTy needs the set of tyvars in scope to avoid generating
@@ -2172,7 +2172,7 @@ lintCoercion co@(TransCo co1 co2)
lintCoercion the_co@(NthCo r0 n co)
= do { co' <- lintCoercion co
; let (Pair s t, r) = coercionKindRole co'
- ; case (splitForAllTy_maybe s, splitForAllTy_maybe t) of
+ ; case (splitForAllTyCoVar_maybe s, splitForAllTyCoVar_maybe t) of
{ (Just _, Just _)
-- works for both tyvar and covar
| n == 0
@@ -2214,7 +2214,7 @@ lintCoercion (InstCo co arg)
; lintRole arg Nominal (coercionRole arg')
- ; case (splitForAllTy_ty_maybe t1, splitForAllTy_ty_maybe t2) of
+ ; case (splitForAllTyVar_maybe t1, splitForAllTyVar_maybe t2) of
-- forall over tvar
{ (Just (tv1,_), Just (tv2,_))
| typeKind s1 `eqType` tyVarKind tv1
@@ -2223,7 +2223,7 @@ lintCoercion (InstCo co arg)
| otherwise
-> failWithL (text "Kind mis-match in inst coercion1" <+> ppr co)
- ; _ -> case (splitForAllTy_co_maybe t1, splitForAllTy_co_maybe t2) of
+ ; _ -> case (splitForAllCoVar_maybe t1, splitForAllCoVar_maybe t2) of
-- forall over covar
{ (Just (cv1, _), Just (cv2, _))
| typeKind s1 `eqType` varType cv1
diff --git a/compiler/GHC/Core/Opt/Arity.hs b/compiler/GHC/Core/Opt/Arity.hs
index 03a8052328..fed664d6fb 100644
--- a/compiler/GHC/Core/Opt/Arity.hs
+++ b/compiler/GHC/Core/Opt/Arity.hs
@@ -145,7 +145,7 @@ typeArity ty
= go initRecTc ty
where
go rec_nts ty
- | Just (_, ty') <- splitForAllTy_maybe ty
+ | Just (_, ty') <- splitForAllTyCoVar_maybe ty
= go rec_nts ty'
| Just (_,arg,res) <- splitFunTy_maybe ty
@@ -1516,7 +1516,7 @@ mkEtaWW orig_oss ppr_orig_expr in_scope orig_ty
go n oss@(one_shot:oss1) subst ty eis -- See Note [exprArity invariant]
----------- Forall types (forall a. ty)
- | Just (tcv,ty') <- splitForAllTy_maybe ty
+ | Just (tcv,ty') <- splitForAllTyCoVar_maybe ty
, (subst', tcv') <- Type.substVarBndr subst tcv
, let oss' | isTyVar tcv = oss
| otherwise = oss1
@@ -1884,7 +1884,7 @@ etaBodyForJoinPoint need_args body
go 0 _ _ rev_bs e
= (reverse rev_bs, e)
go n ty subst rev_bs e
- | Just (tv, res_ty) <- splitForAllTy_maybe ty
+ | Just (tv, res_ty) <- splitForAllTyCoVar_maybe ty
, let (subst', tv') = substVarBndr subst tv
= go (n-1) res_ty subst' (tv' : rev_bs) (e `App` varToCoreExpr tv')
| Just (mult, arg_ty, res_ty) <- splitFunTy_maybe ty
diff --git a/compiler/GHC/Core/Opt/ConstantFold.hs b/compiler/GHC/Core/Opt/ConstantFold.hs
index 52fd2bbf8e..e02a470d7e 100644
--- a/compiler/GHC/Core/Opt/ConstantFold.hs
+++ b/compiler/GHC/Core/Opt/ConstantFold.hs
@@ -1181,7 +1181,7 @@ unsafeEqualityProofRule
= do { [Type rep, Type t1, Type t2] <- getArgs
; guard (t1 `eqType` t2)
; fn <- getFunction
- ; let (_, ue) = splitForAllTys (idType fn)
+ ; let (_, ue) = splitForAllTyCoVars (idType fn)
tc = tyConAppTyCon ue -- tycon: UnsafeEquality
(dc:_) = tyConDataCons tc -- data con: UnsafeRefl
-- UnsafeRefl :: forall (r :: RuntimeRep) (a :: TYPE r).
diff --git a/compiler/GHC/Core/Opt/Simplify/Utils.hs b/compiler/GHC/Core/Opt/Simplify/Utils.hs
index bed5309232..6497abc091 100644
--- a/compiler/GHC/Core/Opt/Simplify/Utils.hs
+++ b/compiler/GHC/Core/Opt/Simplify/Utils.hs
@@ -576,7 +576,7 @@ mkArgInfo env fun rules n_val_args call_cont
add_type_strictness fun_ty dmds
| null dmds = []
- | Just (_, fun_ty') <- splitForAllTy_maybe fun_ty
+ | Just (_, fun_ty') <- splitForAllTyCoVar_maybe fun_ty
= add_type_strictness fun_ty' dmds -- Look through foralls
| Just (_, arg_ty, fun_ty') <- splitFunTy_maybe fun_ty -- Add strict-type info
diff --git a/compiler/GHC/Core/Opt/SpecConstr.hs b/compiler/GHC/Core/Opt/SpecConstr.hs
index c613ac2ebd..4601407723 100644
--- a/compiler/GHC/Core/Opt/SpecConstr.hs
+++ b/compiler/GHC/Core/Opt/SpecConstr.hs
@@ -971,7 +971,7 @@ decreaseSpecCount env n_specs
---------------------------------------------------
-- See Note [Forcing specialisation]
forceSpecBndr :: ScEnv -> Var -> Bool
-forceSpecBndr env var = forceSpecFunTy env . snd . splitForAllTys . varType $ var
+forceSpecBndr env var = forceSpecFunTy env . snd . splitForAllTyCoVars . varType $ var
forceSpecFunTy :: ScEnv -> Type -> Bool
forceSpecFunTy env = any (forceSpecArgTy env) . map scaledThing . fst . splitFunTys
diff --git a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
index 490ca1a189..99f3147ba1 100644
--- a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
+++ b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
@@ -434,7 +434,7 @@ mkWWargs subst fun_ty demands
apply_or_bind_then work_fn_args (varToCoreExpr id),
res_ty) }
- | Just (tv, fun_ty') <- splitForAllTy_maybe fun_ty
+ | Just (tv, fun_ty') <- splitForAllTyCoVar_maybe fun_ty
= do { uniq <- getUniqueM
; let (subst', tv') = cloneTyVarBndr subst tv uniq
-- See Note [Freshen WW arguments]
@@ -1026,7 +1026,7 @@ findTypeShape fam_envs ty
| Just (tc, tc_args) <- splitTyConApp_maybe ty
= go_tc rec_tc tc tc_args
- | Just (_, ty') <- splitForAllTy_maybe ty
+ | Just (_, ty') <- splitForAllTyCoVar_maybe ty
= go rec_tc ty'
| otherwise
diff --git a/compiler/GHC/Core/Predicate.hs b/compiler/GHC/Core/Predicate.hs
index a19f129161..43f52b9b5c 100644
--- a/compiler/GHC/Core/Predicate.hs
+++ b/compiler/GHC/Core/Predicate.hs
@@ -69,7 +69,7 @@ classifyPredType ev_ty = case splitTyConApp_maybe ev_ty of
| Just clas <- tyConClass_maybe tc
-> ClassPred clas tys
- _ | (tvs, rho) <- splitForAllTys ev_ty
+ _ | (tvs, rho) <- splitForAllTyCoVars ev_ty
, (theta, pred) <- splitFunTys rho
, not (null tvs && null theta)
-> ForAllPred tvs (map scaledThing theta) pred
diff --git a/compiler/GHC/Core/TyCo/Ppr.hs b/compiler/GHC/Core/TyCo/Ppr.hs
index 0a14150ed7..2929474d84 100644
--- a/compiler/GHC/Core/TyCo/Ppr.hs
+++ b/compiler/GHC/Core/TyCo/Ppr.hs
@@ -34,7 +34,7 @@ import {-# SOURCE #-} GHC.Core.DataCon
( dataConFullSig , dataConUserTyVarBinders, DataCon )
import GHC.Core.Type ( pickyIsLiftedTypeKind, pattern One, pattern Many,
- splitForAllTysReq, splitForAllTysInvis )
+ splitForAllReqTVBinders, splitForAllInvisTVBinders )
import GHC.Core.TyCon
import GHC.Core.TyCo.Rep
@@ -269,7 +269,7 @@ debug_ppr_ty _ (CoercionTy co)
-- Invisible forall: forall {k} (a :: k). t
debug_ppr_ty prec t
- | (bndrs, body) <- splitForAllTysInvis t
+ | (bndrs, body) <- splitForAllInvisTVBinders t
, not (null bndrs)
= maybeParen prec funPrec $
sep [ text "forall" <+> fsep (map ppr_bndr bndrs) <> dot,
@@ -282,7 +282,7 @@ debug_ppr_ty prec t
-- Visible forall: forall x y -> t
debug_ppr_ty prec t
- | (bndrs, body) <- splitForAllTysReq t
+ | (bndrs, body) <- splitForAllReqTVBinders t
, not (null bndrs)
= maybeParen prec funPrec $
sep [ text "forall" <+> fsep (map ppr_bndr bndrs) <+> arrow,
@@ -294,7 +294,7 @@ debug_ppr_ty prec t
-- Impossible case: neither visible nor invisible forall.
debug_ppr_ty _ ForAllTy{}
- = panic "debug_ppr_ty: neither splitForAllTysInvis nor splitForAllTysReq returned any binders"
+ = panic "debug_ppr_ty: neither splitForAllInvisTVBinders nor splitForAllReqTVBinders returned any binders"
{-
Note [Infix type variables]
diff --git a/compiler/GHC/Core/TyCo/Tidy.hs b/compiler/GHC/Core/TyCo/Tidy.hs
index dd07a2775f..9a3103972c 100644
--- a/compiler/GHC/Core/TyCo/Tidy.hs
+++ b/compiler/GHC/Core/TyCo/Tidy.hs
@@ -139,13 +139,13 @@ tidyType env ty@(FunTy _ w arg res) = let { !w' = tidyType env w
in ty { ft_mult = w', ft_arg = arg', ft_res = res' }
tidyType env (ty@(ForAllTy{})) = mkForAllTys' (zip tvs' vis) $! tidyType env' body_ty
where
- (tvs, vis, body_ty) = splitForAllTys' ty
+ (tvs, vis, body_ty) = splitForAllTyCoVars' ty
(env', tvs') = tidyVarBndrs env tvs
tidyType env (CastTy ty co) = (CastTy $! tidyType env ty) $! (tidyCo env co)
tidyType env (CoercionTy co) = CoercionTy $! (tidyCo env co)
--- The following two functions differ from mkForAllTys and splitForAllTys in that
+-- The following two functions differ from mkForAllTys and splitForAllTyCoVars in that
-- they expect/preserve the ArgFlag argument. These belong to "GHC.Core.Type", but
-- how should they be named?
mkForAllTys' :: [(TyCoVar, ArgFlag)] -> Type -> Type
@@ -153,8 +153,8 @@ mkForAllTys' tvvs ty = foldr strictMkForAllTy ty tvvs
where
strictMkForAllTy (tv,vis) ty = (ForAllTy $! ((Bndr $! tv) $! vis)) $! ty
-splitForAllTys' :: Type -> ([TyCoVar], [ArgFlag], Type)
-splitForAllTys' ty = go ty [] []
+splitForAllTyCoVars' :: Type -> ([TyCoVar], [ArgFlag], Type)
+splitForAllTyCoVars' ty = go ty [] []
where
go (ForAllTy (Bndr tv vis) ty) tvs viss = go ty (tv:tvs) (vis:viss)
go ty tvs viss = (reverse tvs, reverse viss, ty)
diff --git a/compiler/GHC/Core/Type.hs b/compiler/GHC/Core/Type.hs
index 8ae7812c07..bf5fe081d8 100644
--- a/compiler/GHC/Core/Type.hs
+++ b/compiler/GHC/Core/Type.hs
@@ -48,11 +48,11 @@ module GHC.Core.Type (
mkSpecForAllTy, mkSpecForAllTys,
mkVisForAllTys, mkTyCoInvForAllTy,
mkInfForAllTy, mkInfForAllTys,
- splitForAllTys,
- splitForAllTysReq, splitForAllTysInvis,
- splitForAllVarBndrs,
- splitForAllTy_maybe, splitForAllTy,
- splitForAllTy_ty_maybe, splitForAllTy_co_maybe,
+ splitForAllTyCoVars,
+ splitForAllReqTVBinders, splitForAllInvisTVBinders,
+ splitForAllTyCoVarBinders,
+ splitForAllTyCoVar_maybe, splitForAllTyCoVar,
+ splitForAllTyVar_maybe, splitForAllCoVar_maybe,
splitPiTy_maybe, splitPiTy, splitPiTys,
mkTyConBindersPreferAnon,
mkPiTy, mkPiTys,
@@ -1552,8 +1552,8 @@ mkTyConBindersPreferAnon vars inner_tkvs = ASSERT( all isTyVar vars)
-- | Take a ForAllTy apart, returning the list of tycovars and the result type.
-- This always succeeds, even if it returns only an empty list. Note that the
-- result type returned may have free variables that were bound by a forall.
-splitForAllTys :: Type -> ([TyCoVar], Type)
-splitForAllTys ty = split ty ty []
+splitForAllTyCoVars :: Type -> ([TyCoVar], Type)
+splitForAllTyCoVars ty = split ty ty []
where
split _ (ForAllTy (Bndr tv _) ty) tvs = split ty ty (tv:tvs)
split orig_ty ty tvs | Just ty' <- coreView ty = split orig_ty ty' tvs
@@ -1561,38 +1561,38 @@ splitForAllTys ty = split ty ty []
-- | Splits the longest initial sequence of ForAllTys' that satisfy
-- @argf_pred@, returning the binders transformed by @argf_pred@
-splitSomeForAllTys :: (ArgFlag -> Maybe af) -> Type -> ([VarBndr TyCoVar af], Type)
-splitSomeForAllTys argf_pred ty = split ty ty []
+splitSomeForAllTyCoVarBndrs :: (ArgFlag -> Maybe af) -> Type -> ([VarBndr TyCoVar af], Type)
+splitSomeForAllTyCoVarBndrs argf_pred ty = split ty ty []
where
split _ (ForAllTy (Bndr tcv argf) ty) tvs
| Just argf' <- argf_pred argf = split ty ty (Bndr tcv argf' : tvs)
split orig_ty ty tvs | Just ty' <- coreView ty = split orig_ty ty' tvs
split orig_ty _ tvs = (reverse tvs, orig_ty)
--- | Like 'splitForAllTys', but only splits 'ForAllTy's with 'Required' type
+-- | Like 'splitForAllTyCoVars', but only splits 'ForAllTy's with 'Required' type
-- variable binders. Furthermore, each returned tyvar is annotated with '()'.
-splitForAllTysReq :: Type -> ([ReqTVBinder], Type)
-splitForAllTysReq ty = splitSomeForAllTys argf_pred ty
+splitForAllReqTVBinders :: Type -> ([ReqTVBinder], Type)
+splitForAllReqTVBinders ty = splitSomeForAllTyCoVarBndrs argf_pred ty
where
argf_pred :: ArgFlag -> Maybe ()
argf_pred Required = Just ()
argf_pred (Invisible {}) = Nothing
--- | Like 'splitForAllTys', but only splits 'ForAllTy's with 'Invisible' type
+-- | Like 'splitForAllTyCoVars', but only splits 'ForAllTy's with 'Invisible' type
-- variable binders. Furthermore, each returned tyvar is annotated with its
-- 'Specificity'.
-splitForAllTysInvis :: Type -> ([InvisTVBinder], Type)
-splitForAllTysInvis ty = splitSomeForAllTys argf_pred ty
+splitForAllInvisTVBinders :: Type -> ([InvisTVBinder], Type)
+splitForAllInvisTVBinders ty = splitSomeForAllTyCoVarBndrs argf_pred ty
where
argf_pred :: ArgFlag -> Maybe Specificity
argf_pred Required = Nothing
argf_pred (Invisible spec) = Just spec
--- | Like splitForAllTys, but split only for tyvars.
+-- | Like 'splitForAllTyCoVars', but split only for tyvars.
-- This always succeeds, even if it returns only an empty list. Note that the
-- result type returned may have free variables that were bound by a forall.
-splitTyVarForAllTys :: Type -> ([TyVar], Type)
-splitTyVarForAllTys ty = split ty ty []
+splitForAllTyVars :: Type -> ([TyVar], Type)
+splitForAllTyVars ty = split ty ty []
where
split _ (ForAllTy (Bndr tv _) ty) tvs | isTyVar tv = split ty ty (tv:tvs)
split orig_ty ty tvs | Just ty' <- coreView ty = split orig_ty ty' tvs
@@ -1636,10 +1636,10 @@ isFunTy ty
| otherwise = False
-- | Take a forall type apart, or panics if that is not possible.
-splitForAllTy :: Type -> (TyCoVar, Type)
-splitForAllTy ty
- | Just answer <- splitForAllTy_maybe ty = answer
- | otherwise = pprPanic "splitForAllTy" (ppr ty)
+splitForAllTyCoVar :: Type -> (TyCoVar, Type)
+splitForAllTyCoVar ty
+ | Just answer <- splitForAllTyCoVar_maybe ty = answer
+ | otherwise = pprPanic "splitForAllTyCoVar" (ppr ty)
-- | Drops all ForAllTys
dropForAlls :: Type -> Type
@@ -1651,23 +1651,23 @@ dropForAlls ty = go ty
-- | Attempts to take a forall type apart, but only if it's a proper forall,
-- with a named binder
-splitForAllTy_maybe :: Type -> Maybe (TyCoVar, Type)
-splitForAllTy_maybe ty
+splitForAllTyCoVar_maybe :: Type -> Maybe (TyCoVar, Type)
+splitForAllTyCoVar_maybe ty
| ForAllTy (Bndr tv _) inner_ty <- coreFullView ty = Just (tv, inner_ty)
| otherwise = Nothing
--- | Like splitForAllTy_maybe, but only returns Just if it is a tyvar binder.
-splitForAllTy_ty_maybe :: Type -> Maybe (TyCoVar, Type)
-splitForAllTy_ty_maybe ty
+-- | Like 'splitForAllTyCoVar_maybe', but only returns Just if it is a tyvar binder.
+splitForAllTyVar_maybe :: Type -> Maybe (TyCoVar, Type)
+splitForAllTyVar_maybe ty
| ForAllTy (Bndr tv _) inner_ty <- coreFullView ty
, isTyVar tv
= Just (tv, inner_ty)
| otherwise = Nothing
--- | Like splitForAllTy_maybe, but only returns Just if it is a covar binder.
-splitForAllTy_co_maybe :: Type -> Maybe (TyCoVar, Type)
-splitForAllTy_co_maybe ty
+-- | Like 'splitForAllTyCoVar_maybe', but only returns Just if it is a covar binder.
+splitForAllCoVar_maybe :: Type -> Maybe (TyCoVar, Type)
+splitForAllCoVar_maybe ty
| ForAllTy (Bndr tv _) inner_ty <- coreFullView ty
, isCoVar tv
= Just (tv, inner_ty)
@@ -1702,14 +1702,14 @@ splitPiTys ty = split ty ty []
split orig_ty _ bs = (reverse bs, orig_ty)
-- | Like 'splitPiTys' but split off only /named/ binders
--- and returns TyCoVarBinders rather than TyCoBinders
-splitForAllVarBndrs :: Type -> ([TyCoVarBinder], Type)
-splitForAllVarBndrs ty = split ty ty []
+-- and returns 'TyCoVarBinder's rather than 'TyCoBinder's
+splitForAllTyCoVarBinders :: Type -> ([TyCoVarBinder], Type)
+splitForAllTyCoVarBinders ty = split ty ty []
where
split orig_ty ty bs | Just ty' <- coreView ty = split orig_ty ty' bs
split _ (ForAllTy b res) bs = split res res (b:bs)
split orig_ty _ bs = (reverse bs, orig_ty)
-{-# INLINE splitForAllVarBndrs #-}
+{-# INLINE splitForAllTyCoVarBinders #-}
invisibleTyBndrCount :: Type -> Int
-- Returns the number of leading invisible forall'd binders in the type
@@ -2114,7 +2114,7 @@ isValidJoinPointType arity ty
valid_under tvs arity ty
| arity == 0
= tvs `disjointVarSet` tyCoVarsOfType ty
- | Just (t, ty') <- splitForAllTy_maybe ty
+ | Just (t, ty') <- splitForAllTyCoVar_maybe ty
= valid_under (tvs `extendVarSet` t) (arity-1) ty'
| Just (_, _, res_ty) <- splitFunTy_maybe ty
= valid_under tvs (arity-1) res_ty
@@ -2497,7 +2497,7 @@ typeKind ty@(ForAllTy {})
Nothing -> pprPanic "typeKind"
(ppr ty $$ ppr tvs $$ ppr body <+> dcolon <+> ppr body_kind)
where
- (tvs, body) = splitTyVarForAllTys ty
+ (tvs, body) = splitForAllTyVars ty
body_kind = typeKind body
---------------------------------------------
@@ -2542,7 +2542,7 @@ tcTypeKind ty@(ForAllTy {})
Nothing -> pprPanic "tcTypeKind"
(ppr ty $$ ppr tvs $$ ppr body <+> dcolon <+> ppr body_kind)
where
- (tvs, body) = splitTyVarForAllTys ty
+ (tvs, body) = splitForAllTyVars ty
body_kind = tcTypeKind body