summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs3
-rw-r--r--compiler/GHC/Core/Make.hs17
-rw-r--r--compiler/GHC/Core/Opt/WorkWrap.hs4
-rw-r--r--compiler/GHC/Core/Type.hs2
-rw-r--r--compiler/GHC/HsToCore/Utils.hs14
-rw-r--r--compiler/GHC/Tc/Validity.hs3
6 files changed, 15 insertions, 28 deletions
diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs b/compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
index f15f9ff4ba..5cf7565495 100644
--- a/compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
@@ -199,8 +199,7 @@ joinToTargets_again
(return ())
-}
delta <- getDeltaR
- fixUpInstrs_ <- mapM (handleComponent delta instr) sccs
- let fixUpInstrs = concat fixUpInstrs_
+ fixUpInstrs <- concatMapM (handleComponent delta instr) sccs
-- make a new basic block containing the fixup code.
-- A the end of the current block we will jump to the fixup one,
diff --git a/compiler/GHC/Core/Make.hs b/compiler/GHC/Core/Make.hs
index 2d567786ea..abd28baa47 100644
--- a/compiler/GHC/Core/Make.hs
+++ b/compiler/GHC/Core/Make.hs
@@ -6,7 +6,7 @@ module GHC.Core.Make (
mkCoreLet, mkCoreLets,
mkCoreApp, mkCoreApps, mkCoreConApps,
mkCoreLams, mkWildCase, mkIfThenElse,
- mkWildValBinder, mkWildEvBinder,
+ mkWildValBinder,
mkSingleAltCase,
sortQuantVars, castBottomExpr,
@@ -54,7 +54,7 @@ import GHC.Prelude
import GHC.Platform
import GHC.Types.Id
-import GHC.Types.Var ( EvVar, setTyVarUnique, visArgConstraintLike )
+import GHC.Types.Var ( setTyVarUnique, visArgConstraintLike )
import GHC.Types.TyThing
import GHC.Types.Id.Info
import GHC.Types.Cpr
@@ -173,9 +173,6 @@ mkCoreAppTyped d (fun, fun_ty) arg
* *
********************************************************************* -}
-mkWildEvBinder :: PredType -> EvVar
-mkWildEvBinder pred = mkWildValBinder ManyTy pred
-
-- | Make a /wildcard binder/. This is typically used when you need a binder
-- that you expect to use only at a *binding* site. Do not use it at
-- occurrence sites because it has a single, fixed unique, and it's very
@@ -1082,8 +1079,9 @@ mkImpossibleExpr :: Type -> String -> CoreExpr
mkImpossibleExpr res_ty str
= mkRuntimeErrorApp err_id res_ty str
where -- See Note [Type vs Constraint for error ids]
- err_id | isConstraintLikeKind (typeKind res_ty) = iMPOSSIBLE_CONSTRAINT_ERROR_ID
- | otherwise = iMPOSSIBLE_ERROR_ID
+ err_id = case typeTypeOrConstraint res_ty of
+ TypeLike -> iMPOSSIBLE_ERROR_ID
+ ConstraintLike -> iMPOSSIBLE_CONSTRAINT_ERROR_ID
{- Note [Type vs Constraint for error ids]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1207,8 +1205,9 @@ mkAbsentErrorApp :: Type -- The type to instantiate 'a'
mkAbsentErrorApp res_ty err_msg
= mkApps (Var err_id) [ Type res_ty, err_string ]
where
- err_id | isConstraintLikeKind (typeKind res_ty) = aBSENT_CONSTRAINT_ERROR_ID
- | otherwise = aBSENT_ERROR_ID
+ err_id = case typeTypeOrConstraint res_ty of
+ TypeLike -> aBSENT_ERROR_ID
+ ConstraintLike -> aBSENT_CONSTRAINT_ERROR_ID
err_string = Lit (mkLitString err_msg)
absentErrorName, absentConstraintErrorName :: Name
diff --git a/compiler/GHC/Core/Opt/WorkWrap.hs b/compiler/GHC/Core/Opt/WorkWrap.hs
index 1ed95703af..29f1e3973f 100644
--- a/compiler/GHC/Core/Opt/WorkWrap.hs
+++ b/compiler/GHC/Core/Opt/WorkWrap.hs
@@ -68,9 +68,7 @@ info for exported values).
wwTopBinds :: WwOpts -> UniqSupply -> CoreProgram -> CoreProgram
wwTopBinds ww_opts us top_binds
- = initUs_ us $ do
- top_binds' <- mapM (wwBind ww_opts) top_binds
- return (concat top_binds')
+ = initUs_ us $ concatMapM (wwBind ww_opts) top_binds
{-
************************************************************************
diff --git a/compiler/GHC/Core/Type.hs b/compiler/GHC/Core/Type.hs
index e16ff2faa6..c35c534dea 100644
--- a/compiler/GHC/Core/Type.hs
+++ b/compiler/GHC/Core/Type.hs
@@ -770,7 +770,7 @@ isBoxedRuntimeRep rep = isJust (isBoxedRuntimeRep_maybe rep)
-- expands to `Boxed lev` and returns `Nothing` otherwise.
--
-- Types with this runtime rep are represented by pointers on the GC'd heap.
-isBoxedRuntimeRep_maybe :: RuntimeRepType -> Maybe Type
+isBoxedRuntimeRep_maybe :: RuntimeRepType -> Maybe LevityType
isBoxedRuntimeRep_maybe rep
| Just (rr_tc, args) <- splitRuntimeRep_maybe rep
, rr_tc `hasKey` boxedRepDataConKey
diff --git a/compiler/GHC/HsToCore/Utils.hs b/compiler/GHC/HsToCore/Utils.hs
index f919a422c5..a64c8b74bc 100644
--- a/compiler/GHC/HsToCore/Utils.hs
+++ b/compiler/GHC/HsToCore/Utils.hs
@@ -81,7 +81,6 @@ import GHC.Types.Tickish
import GHC.Utils.Misc
import GHC.Driver.Session
import GHC.Driver.Ppr
-import GHC.Data.FastString
import qualified GHC.LanguageExtensions as LangExt
import GHC.Tc.Types.Evidence
@@ -995,19 +994,10 @@ mkOptTickBox = flip (foldr Tick)
mkBinaryTickBox :: Int -> Int -> CoreExpr -> DsM CoreExpr
mkBinaryTickBox ixT ixF e = do
- uq <- newUnique
this_mod <- getModule
- let bndr1 = mkSysLocal (fsLit "t1") uq OneTy boolTy
- -- It's always sufficient to pattern-match on a boolean with
- -- multiplicity 'One'.
- let
+ let trueBox = Tick (HpcTick this_mod ixT) (Var trueDataConId)
falseBox = Tick (HpcTick this_mod ixF) (Var falseDataConId)
- trueBox = Tick (HpcTick this_mod ixT) (Var trueDataConId)
- --
- return $ Case e bndr1 boolTy
- [ Alt (DataAlt falseDataCon) [] falseBox
- , Alt (DataAlt trueDataCon) [] trueBox
- ]
+ return $ mkIfThenElse e trueBox falseBox
diff --git a/compiler/GHC/Tc/Validity.hs b/compiler/GHC/Tc/Validity.hs
index 949eb90d53..ff1c616974 100644
--- a/compiler/GHC/Tc/Validity.hs
+++ b/compiler/GHC/Tc/Validity.hs
@@ -774,7 +774,8 @@ check_type (ve@ValidityEnv{ ve_tidy_env = env, ve_ctxt = ctxt
where
(arg_rank, res_rank) = funArgResRank rank
-check_type _ ty = pprPanic "check_type" (ppr ty)
+check_type _ ty@(ForAllTy {}) = pprPanic "check_type" (ppr ty)
+check_type _ ty@(CoercionTy {}) = pprPanic "check_type" (ppr ty)
----------------------------------------
check_syn_tc_app :: ValidityEnv