[commit: ghc] no-pred-ty: Nuke isCertainlyPredReprTy (c4c9810)
Simon Peyton Jones
simonpj at microsoft.com
Wed Sep 7 18:45:14 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : no-pred-ty
http://hackage.haskell.org/trac/ghc/changeset/c4c9810862fde76641d3ad60a0d3ee3da526c209
>---------------------------------------------------------------
commit c4c9810862fde76641d3ad60a0d3ee3da526c209
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Sep 7 17:44:52 2011 +0100
Nuke isCertainlyPredReprTy
>---------------------------------------------------------------
compiler/basicTypes/Id.lhs | 6 +++---
compiler/coreSyn/CoreUtils.lhs | 4 ++--
compiler/types/Type.lhs | 19 ++++---------------
3 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/compiler/basicTypes/Id.lhs b/compiler/basicTypes/Id.lhs
index e66fbeb..2536497 100644
--- a/compiler/basicTypes/Id.lhs
+++ b/compiler/basicTypes/Id.lhs
@@ -58,7 +58,7 @@ module Id (
hasNoBinding,
-- ** Evidence variables
- DictId, isDictId, isCertainlyEvVar,
+ DictId, isDictId, isEvVar,
-- ** Inline pragma stuff
idInlinePragma, setInlinePragma, modifyInlinePragma,
@@ -447,8 +447,8 @@ isTickBoxOp_maybe id =
%************************************************************************
\begin{code}
-isCertainlyEvVar :: Var -> Bool
-isCertainlyEvVar var = isCertainlyPredReprTy (varType var)
+isEvVar :: Var -> Bool
+isEvVar var = isPredTy (varType var)
isDictId :: Id -> Bool
isDictId id = isDictTy (idType id)
diff --git a/compiler/coreSyn/CoreUtils.lhs b/compiler/coreSyn/CoreUtils.lhs
index 0b10210..bc1e45e 100644
--- a/compiler/coreSyn/CoreUtils.lhs
+++ b/compiler/coreSyn/CoreUtils.lhs
@@ -630,7 +630,7 @@ isExpandableApp fn n_val_args
go n_val_args ty
| Just (_, ty) <- splitForAllTy_maybe ty = go n_val_args ty
| Just (arg, ty) <- splitFunTy_maybe ty
- , isCertainlyPredReprTy arg = go (n_val_args-1) ty
+ , isPredTy arg = go (n_val_args-1) ty
| otherwise = False
\end{code}
@@ -1435,7 +1435,7 @@ tryEtaReduce bndrs body
| otherwise = idArity fun
---------------
- ok_lam v = isTyVar v || isCertainlyEvVar v
+ ok_lam v = isTyVar v || isEvVar v
---------------
ok_arg :: Var -- Of type bndr_t
diff --git a/compiler/types/Type.lhs b/compiler/types/Type.lhs
index 27108a5..0811ba5 100644
--- a/compiler/types/Type.lhs
+++ b/compiler/types/Type.lhs
@@ -61,7 +61,7 @@ module Type (
funTyCon,
-- ** Predicates on types
- isTyVarTy, isFunTy, isDictTy, isCertainlyPredReprTy, isPredTy,
+ isTyVarTy, isFunTy, isDictTy, isPredTy,
-- (Lifting and boxity)
isUnLiftedType, isUnboxedTupleType, isAlgType, isClosedAlgType,
@@ -774,6 +774,9 @@ noParenPred :: PredType -> Bool
-- But (?x::Int) => Int -> Int
noParenPred p = isClassPred p || isEqPred p
+isPredTy :: Type -> Bool
+isPredTy ty = typeKind ty `eqKind` constraintKind
+
isClassPred, isEqPred, isIPPred :: PredType -> Bool
isClassPred ty = case tyConAppTyCon_maybe ty of
Just tyCon | isClassTyCon tyCon -> True
@@ -788,20 +791,6 @@ isIPPred ty = case tyConAppTyCon_maybe ty of
Make PredTypes
-\begin{code}
--- We can't tell if a type originated from an IParam predicate, so
--- this function is conservative. It is only used in the eta-contraction/expansion
--- logic at the moment, so this doesn't matter a great deal.
-isCertainlyPredReprTy :: Type -> Bool
-isCertainlyPredReprTy ty | Just ty' <- coreView ty = isCertainlyPredReprTy ty'
-isCertainlyPredReprTy ty = case tyConAppTyCon_maybe ty of
- Just tc -> tc `hasKey` eqPrimTyConKey || isClassTyCon tc
- Nothing -> False
-
-isPredTy :: Type -> Bool
-isPredTy ty = typeKind ty `eqKind` constraintKind
-\end{code}
-
--------------------- Equality types ---------------------------------
\begin{code}
-- | Creates a type equality predicate
More information about the Cvs-ghc
mailing list