summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/Core.hs14
-rw-r--r--compiler/GHC/Core/Opt/WorkWrap/Utils.hs2
-rw-r--r--compiler/GHC/Core/Type.hs8
-rw-r--r--compiler/GHC/Core/Utils.hs8
-rw-r--r--compiler/GHC/Tc/Deriv/Utils.hs4
-rw-r--r--compiler/GHC/Types/RepType.hs24
-rw-r--r--compiler/GHC/Utils/Error.hs6
7 files changed, 16 insertions, 50 deletions
diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs
index a3dedcc0fb..c5d0a86d14 100644
--- a/compiler/GHC/Core.hs
+++ b/compiler/GHC/Core.hs
@@ -46,8 +46,8 @@ module GHC.Core (
collectNBinders,
collectArgs, stripNArgs, collectArgsTicks, flattenBinds,
- exprToType, exprToCoercion_maybe,
- applyTypeToArg, wrapLamBody,
+ exprToType,
+ wrapLamBody,
isValArg, isTypeArg, isCoArg, isTyCoArg, valArgCount, valBndrCount,
isRuntimeArg, isRuntimeVar,
@@ -1904,22 +1904,12 @@ These are defined here to avoid a module loop between GHC.Core.Utils and GHC.Cor
-}
-applyTypeToArg :: Type -> CoreExpr -> Type
--- ^ Determines the type resulting from applying an expression with given type
--- to a given argument expression
-applyTypeToArg fun_ty arg = piResultTy fun_ty (exprToType arg)
-
-- | If the expression is a 'Type', converts. Otherwise,
-- panics. NB: This does /not/ convert 'Coercion' to 'CoercionTy'.
exprToType :: CoreExpr -> Type
exprToType (Type ty) = ty
exprToType _bad = pprPanic "exprToType" empty
--- | If the expression is a 'Coercion', converts.
-exprToCoercion_maybe :: CoreExpr -> Maybe Coercion
-exprToCoercion_maybe (Coercion co) = Just co
-exprToCoercion_maybe _ = Nothing
-
{-
************************************************************************
* *
diff --git a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
index 6bb751d803..63ac670418 100644
--- a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
+++ b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs
@@ -1131,7 +1131,7 @@ Needless to say, there are some wrinkles:
of the form @TYPE rep@ where @rep@ is not (and doesn't contain) a variable.
Why? Because if we don't know its representation (e.g. size in memory,
register class), we don't know what or how much rubbish to emit in codegen.
- 'typeMonoPrimRep_maybe' returns 'Nothing' in this case and we simply fall
+ 'mkLitRubbish' returns 'Nothing' in this case and we simply fall
back to passing the original parameter to the worker.
Note that currently this case should not occur, because binders always
diff --git a/compiler/GHC/Core/Type.hs b/compiler/GHC/Core/Type.hs
index 6adf7c7a34..bc864c301f 100644
--- a/compiler/GHC/Core/Type.hs
+++ b/compiler/GHC/Core/Type.hs
@@ -1428,13 +1428,13 @@ applyTysX :: [TyVar] -> Type -> [Type] -> Type
-- applyTyxX beta-reduces (/\tvs. body_ty) arg_tys
-- Assumes that (/\tvs. body_ty) is closed
applyTysX tvs body_ty arg_tys
- = assertPpr (arg_tys `lengthAtLeast` n_tvs) pp_stuff $
+ = assertPpr (tvs `leLength` arg_tys) pp_stuff $
assertPpr (tyCoVarsOfType body_ty `subVarSet` mkVarSet tvs) pp_stuff $
- mkAppTys (substTyWith tvs (take n_tvs arg_tys) body_ty)
- (drop n_tvs arg_tys)
+ mkAppTys (substTyWith tvs arg_tys_prefix body_ty)
+ arg_tys_rest
where
pp_stuff = vcat [ppr tvs, ppr body_ty, ppr arg_tys]
- n_tvs = length tvs
+ (arg_tys_prefix, arg_tys_rest) = splitAtList tvs arg_tys
diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs
index 5100f958e6..90f8f3f032 100644
--- a/compiler/GHC/Core/Utils.hs
+++ b/compiler/GHC/Core/Utils.hs
@@ -41,8 +41,8 @@ module GHC.Core.Utils (
tryEtaReduce, canEtaReduceToArity,
-- * Manipulating data constructors and types
- exprToType, exprToCoercion_maybe,
- applyTypeToArgs, applyTypeToArg,
+ exprToType,
+ applyTypeToArgs,
dataConRepInstPat, dataConRepFSInstPat,
isEmptyTy, normSplitTyConApp_maybe,
@@ -232,9 +232,9 @@ Various possibilities suggest themselves:
Note that there might be existentially quantified coercion variables, too.
-}
--- Not defined with applyTypeToArg because you can't print from GHC.Core.
applyTypeToArgs :: HasDebugCallStack => SDoc -> Type -> [CoreExpr] -> Type
--- ^ A more efficient version of 'applyTypeToArg' when we have several arguments.
+-- ^ Determines the type resulting from applying an expression with given type
+--- to given argument expressions.
-- The first argument is just for debugging, and gives some context
applyTypeToArgs pp_e op_ty args
= go op_ty args
diff --git a/compiler/GHC/Tc/Deriv/Utils.hs b/compiler/GHC/Tc/Deriv/Utils.hs
index aa89f94c4b..f28ad0e8f4 100644
--- a/compiler/GHC/Tc/Deriv/Utils.hs
+++ b/compiler/GHC/Tc/Deriv/Utils.hs
@@ -989,8 +989,8 @@ cond_stdOK deriv_ctxt permissive dflags
InferContext wildcard
| null data_cons -- 1.
, not permissive
- -> checkFlag LangExt.EmptyDataDeriving dflags dit `orValid`
- NotValid (no_cons_why rep_tc)
+ , not (xopt LangExt.EmptyDataDeriving dflags)
+ -> NotValid (no_cons_why rep_tc)
| not (null con_whys)
-> NotValid $ DerivErrBadConstructor (Just $ has_wildcard wildcard) con_whys
| otherwise
diff --git a/compiler/GHC/Types/RepType.hs b/compiler/GHC/Types/RepType.hs
index 41223c625f..b565bd7400 100644
--- a/compiler/GHC/Types/RepType.hs
+++ b/compiler/GHC/Types/RepType.hs
@@ -11,7 +11,7 @@ module GHC.Types.RepType
isZeroBitTy,
-- * Type representation for the code generator
- typePrimRep, typePrimRep1, typeMonoPrimRep_maybe,
+ typePrimRep, typePrimRep1,
runtimeRepPrimRep, typePrimRepArgs,
PrimRep(..), primRepToType,
countFunRepArgs, countConRepArgs, dataConRuntimeRepStrictness,
@@ -32,7 +32,7 @@ import GHC.Core.TyCon
import GHC.Core.TyCon.RecWalk
import GHC.Core.TyCo.Rep
import GHC.Core.Type
-import {-# SOURCE #-} GHC.Builtin.Types ( anyTypeOfKind, runtimeRepTy
+import {-# SOURCE #-} GHC.Builtin.Types ( anyTypeOfKind
, vecRepDataConTyCon
, liftedRepTy, unliftedRepTy, zeroBitRepTy
, intRepDataConTy
@@ -544,14 +544,6 @@ typePrimRep1 ty = case typePrimRep ty of
[rep] -> rep
_ -> pprPanic "typePrimRep1" (ppr ty $$ ppr (typePrimRep ty))
--- | Like 'typePrimRep', but returns 'Nothing' instead of panicking, when
---
--- * The @ty@ was not of form @TYPE rep@
--- * @rep@ was not monomorphic
---
-typeMonoPrimRep_maybe :: Type -> Maybe [PrimRep]
-typeMonoPrimRep_maybe ty = getRuntimeRep_maybe ty >>= runtimeRepMonoPrimRep_maybe
-
-- | Find the runtime representation of a 'TyCon'. Defined here to
-- avoid module loops. Returns a list of the register shapes necessary.
-- See also Note [Getting from RuntimeRep to PrimRep]
@@ -585,18 +577,6 @@ kindPrimRep doc ki
= pprPanic "kindPrimRep" (ppr ki $$ doc)
-- | Take a type of kind RuntimeRep and extract the list of 'PrimRep' that
--- it encodes if it's a monomorphic rep. Otherwise returns 'Nothing'.
--- See also Note [Getting from RuntimeRep to PrimRep]
-runtimeRepMonoPrimRep_maybe :: HasDebugCallStack => Type -> Maybe [PrimRep]
-runtimeRepMonoPrimRep_maybe rr_ty
- | Just (rr_dc, args) <- splitTyConApp_maybe rr_ty
- , assertPpr (runtimeRepTy `eqType` typeKind rr_ty) (ppr rr_ty) True
- , RuntimeRep fun <- tyConRuntimeRepInfo rr_dc
- = Just (fun args)
- | otherwise
- = Nothing -- not mono rep
-
--- | Take a type of kind RuntimeRep and extract the list of 'PrimRep' that
-- it encodes. See also Note [Getting from RuntimeRep to PrimRep]
-- The [PrimRep] is the final runtime representation /after/ unarisation
runtimeRepPrimRep :: HasDebugCallStack => SDoc -> Type -> [PrimRep]
diff --git a/compiler/GHC/Utils/Error.hs b/compiler/GHC/Utils/Error.hs
index 7d2eb34c3b..db8107a65f 100644
--- a/compiler/GHC/Utils/Error.hs
+++ b/compiler/GHC/Utils/Error.hs
@@ -11,7 +11,7 @@
module GHC.Utils.Error (
-- * Basic types
- Validity'(..), Validity, andValid, allValid, getInvalids, orValid,
+ Validity'(..), Validity, andValid, allValid, getInvalids,
Severity(..),
-- * Messages
@@ -212,10 +212,6 @@ allValid (v : vs) = v `andValid` allValid vs
getInvalids :: [Validity' a] -> [a]
getInvalids vs = [d | NotValid d <- vs]
-orValid :: Validity' a -> Validity' a -> Validity' a
-orValid IsValid _ = IsValid
-orValid _ v = v
-
-- -----------------------------------------------------------------------------
-- Collecting up messages for later ordering and printing.