summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@richarde.dev>2020-09-04 17:27:00 -0400
committerRichard Eisenberg <rae@richarde.dev>2020-09-04 17:27:00 -0400
commit025c8c92060d8fc6aa9723302b5e7b250735151b (patch)
tree7c182fc115fd999696279070937e387c74b283c5
parentc1e54439be3d38a1f972ac772cca7eec5e1519a9 (diff)
downloadhaskell-wip/no-iface-tuple-ty.tar.gz
Remove IfaceTupleTy.wip/no-iface-tuple-ty
It seemed to be serving no purpose, so I removed it. Still to do: remove tcTupleTyCon, but that will be much easier after !3954.
-rw-r--r--compiler/GHC/CoreToIface.hs13
-rw-r--r--compiler/GHC/Iface/Rename.hs2
-rw-r--r--compiler/GHC/Iface/Syntax.hs1
-rw-r--r--compiler/GHC/Iface/Type.hs19
-rw-r--r--compiler/GHC/IfaceToCore.hs16
5 files changed, 1 insertions, 50 deletions
diff --git a/compiler/GHC/CoreToIface.hs b/compiler/GHC/CoreToIface.hs
index a65e89853c..5c8ec4f0a9 100644
--- a/compiler/GHC/CoreToIface.hs
+++ b/compiler/GHC/CoreToIface.hs
@@ -182,16 +182,6 @@ toIfaceTypeX fr (CastTy ty co) = IfaceCastTy (toIfaceTypeX fr ty) (toIfaceCoerc
toIfaceTypeX fr (CoercionTy co) = IfaceCoercionTy (toIfaceCoercionX fr co)
toIfaceTypeX fr (TyConApp tc tys)
- -- tuples
- | Just sort <- tyConTuple_maybe tc
- , n_tys == arity
- = IfaceTupleTy sort NotPromoted (toIfaceTcArgsX fr tc tys)
-
- | Just dc <- isPromotedDataCon_maybe tc
- , isBoxedTupleDataCon dc
- , n_tys == 2*arity
- = IfaceTupleTy BoxedTuple IsPromoted (toIfaceTcArgsX fr tc (drop arity tys))
-
| tc `elem` [ eqPrimTyCon, eqReprPrimTyCon, heqTyCon ]
, (k1:k2:_) <- tys
= let info = IfaceTyConInfo NotPromoted sort
@@ -202,9 +192,6 @@ toIfaceTypeX fr (TyConApp tc tys)
-- other applications
| otherwise
= IfaceTyConApp (toIfaceTyCon tc) (toIfaceTcArgsX fr tc tys)
- where
- arity = tyConArity tc
- n_tys = length tys
toIfaceTyVar :: TyVar -> FastString
toIfaceTyVar = occNameFS . getOccName
diff --git a/compiler/GHC/Iface/Rename.hs b/compiler/GHC/Iface/Rename.hs
index 376eee8350..75ed14598e 100644
--- a/compiler/GHC/Iface/Rename.hs
+++ b/compiler/GHC/Iface/Rename.hs
@@ -726,8 +726,6 @@ rnIfaceType (IfaceAppTy t1 t2)
rnIfaceType (IfaceLitTy l) = return (IfaceLitTy l)
rnIfaceType (IfaceFunTy af w t1 t2)
= IfaceFunTy af <$> rnIfaceType w <*> rnIfaceType t1 <*> rnIfaceType t2
-rnIfaceType (IfaceTupleTy s i tks)
- = IfaceTupleTy s i <$> rnIfaceAppArgs tks
rnIfaceType (IfaceTyConApp tc tks)
= IfaceTyConApp <$> rnIfaceTyCon tc <*> rnIfaceAppArgs tks
rnIfaceType (IfaceForAllTy tv t)
diff --git a/compiler/GHC/Iface/Syntax.hs b/compiler/GHC/Iface/Syntax.hs
index bd576b26cf..2bdbb8ac1b 100644
--- a/compiler/GHC/Iface/Syntax.hs
+++ b/compiler/GHC/Iface/Syntax.hs
@@ -1638,7 +1638,6 @@ freeNamesIfType (IfaceFreeTyVar _) = emptyNameSet
freeNamesIfType (IfaceTyVar _) = emptyNameSet
freeNamesIfType (IfaceAppTy s t) = freeNamesIfType s &&& freeNamesIfAppArgs t
freeNamesIfType (IfaceTyConApp tc ts) = freeNamesIfTc tc &&& freeNamesIfAppArgs ts
-freeNamesIfType (IfaceTupleTy _ _ ts) = freeNamesIfAppArgs ts
freeNamesIfType (IfaceLitTy _) = emptyNameSet
freeNamesIfType (IfaceForAllTy tv t) = freeNamesIfVarBndr tv &&& freeNamesIfType t
freeNamesIfType (IfaceFunTy _ w s t) = freeNamesIfType s &&& freeNamesIfType t &&& freeNamesIfType w
diff --git a/compiler/GHC/Iface/Type.hs b/compiler/GHC/Iface/Type.hs
index 57c31920b4..32c216b3f1 100644
--- a/compiler/GHC/Iface/Type.hs
+++ b/compiler/GHC/Iface/Type.hs
@@ -171,12 +171,6 @@ data IfaceType
| IfaceCastTy IfaceType IfaceCoercion
| IfaceCoercionTy IfaceCoercion
- | IfaceTupleTy -- Saturated tuples (unsaturated ones use IfaceTyConApp)
- TupleSort -- What sort of tuple?
- PromotionFlag -- A bit like IfaceTyCon
- IfaceAppArgs -- arity = length args
- -- For promoted data cons, the kind args are omitted
-
type IfaceMult = IfaceType
type IfacePredType = IfaceType
@@ -498,7 +492,6 @@ ifTypeIsVarFree ty = go ty
go (IfaceFunTy _ w arg res) = go w && go arg && go res
go (IfaceForAllTy {}) = False
go (IfaceTyConApp _ args) = go_args args
- go (IfaceTupleTy _ _ args) = go_args args
go (IfaceLitTy _) = True
go (IfaceCastTy {}) = False -- Safe
go (IfaceCoercionTy {}) = False -- Safe
@@ -533,7 +526,6 @@ substIfaceType env ty
go (IfaceFunTy af w t1 t2) = IfaceFunTy af (go w) (go t1) (go t2)
go ty@(IfaceLitTy {}) = ty
go (IfaceTyConApp tc tys) = IfaceTyConApp tc (substIfaceAppArgs env tys)
- go (IfaceTupleTy s i tys) = IfaceTupleTy s i (substIfaceAppArgs env tys)
go (IfaceForAllTy {}) = pprPanic "substIfaceType" (ppr ty)
go (IfaceCastTy ty co) = IfaceCastTy (go ty) (go_co co)
go (IfaceCoercionTy co) = IfaceCoercionTy (go_co co)
@@ -898,7 +890,6 @@ ppr_ty ctxt_prec ty@(IfaceFunTy InvisArg _ _ _) = ppr_sigma ctxt_prec ty
ppr_ty _ (IfaceFreeTyVar tyvar) = ppr tyvar -- This is the main reason for IfaceFreeTyVar!
ppr_ty _ (IfaceTyVar tyvar) = ppr tyvar -- See Note [TcTyVars in IfaceType]
ppr_ty ctxt_prec (IfaceTyConApp tc tys) = pprTyTcApp ctxt_prec tc tys
-ppr_ty ctxt_prec (IfaceTupleTy i p tys) = pprTuple ctxt_prec i p tys
ppr_ty _ (IfaceLitTy n) = pprIfaceTyLit n
-- Function types
ppr_ty ctxt_prec (IfaceFunTy _ w ty1 ty2) -- Should be VisArg
@@ -1043,9 +1034,6 @@ defaultNonStandardVars do_runtimereps do_multiplicities ty = go False emptyFsEnv
go ink subs (IfaceTyConApp tc tc_args)
= IfaceTyConApp tc (go_args ink subs tc_args)
- go ink subs (IfaceTupleTy sort is_prom tc_args)
- = IfaceTupleTy sort is_prom (go_args ink subs tc_args)
-
go ink subs (IfaceFunTy af w arg res)
= IfaceFunTy af (go ink subs w) (go ink subs arg) (go ink subs res)
@@ -1866,10 +1854,8 @@ instance Binary IfaceType where
= do { putByte bh 6; put_ bh a; put_ bh b }
put_ bh (IfaceCoercionTy a)
= do { putByte bh 7; put_ bh a }
- put_ bh (IfaceTupleTy s i tys)
- = do { putByte bh 8; put_ bh s; put_ bh i; put_ bh tys }
put_ bh (IfaceLitTy n)
- = do { putByte bh 9; put_ bh n }
+ = do { putByte bh 8; put_ bh n }
get bh = do
h <- getByte bh
@@ -1894,8 +1880,6 @@ instance Binary IfaceType where
7 -> do { a <- get bh
; return (IfaceCoercionTy a) }
- 8 -> do { s <- get bh; i <- get bh; tys <- get bh
- ; return (IfaceTupleTy s i tys) }
_ -> do n <- get bh
return (IfaceLitTy n)
@@ -2094,7 +2078,6 @@ instance NFData IfaceType where
IfaceTyConApp f1 f2 -> rnf f1 `seq` rnf f2
IfaceCastTy f1 f2 -> rnf f1 `seq` rnf f2
IfaceCoercionTy f1 -> rnf f1
- IfaceTupleTy f1 f2 f3 -> f1 `seq` f2 `seq` rnf f3
instance NFData IfaceTyLit where
rnf = \case
diff --git a/compiler/GHC/IfaceToCore.hs b/compiler/GHC/IfaceToCore.hs
index ae6461ce3a..a1ce2cadfa 100644
--- a/compiler/GHC/IfaceToCore.hs
+++ b/compiler/GHC/IfaceToCore.hs
@@ -1105,7 +1105,6 @@ tcIfaceRule (IfaceRule {ifRuleName = name, ifActivation = act, ifRuleBndrs = bnd
-- to write them out in coreRuleToIfaceRule
ifTopFreeName :: IfaceExpr -> Maybe Name
ifTopFreeName (IfaceType (IfaceTyConApp tc _ )) = Just (ifaceTyConName tc)
- ifTopFreeName (IfaceType (IfaceTupleTy s _ ts)) = Just (tupleTyConName s (length (appArgsIfaceTypes ts)))
ifTopFreeName (IfaceApp f _) = ifTopFreeName f
ifTopFreeName (IfaceExt n) = Just n
ifTopFreeName _ = Nothing
@@ -1167,7 +1166,6 @@ tcIfaceType = go
go (IfaceFreeTyVar n) = pprPanic "tcIfaceType:IfaceFreeTyVar" (ppr n)
go (IfaceLitTy l) = LitTy <$> tcIfaceTyLit l
go (IfaceFunTy flag w t1 t2) = FunTy flag <$> tcIfaceType w <*> go t1 <*> go t2
- go (IfaceTupleTy s i tks) = tcIfaceTupleTy s i tks
go (IfaceAppTy t ts)
= do { t' <- go t
; ts' <- traverse go (appArgsIfaceTypes ts)
@@ -1182,20 +1180,6 @@ tcIfaceType = go
go (IfaceCastTy ty co) = CastTy <$> go ty <*> tcIfaceCo co
go (IfaceCoercionTy co) = CoercionTy <$> tcIfaceCo co
-tcIfaceTupleTy :: TupleSort -> PromotionFlag -> IfaceAppArgs -> IfL Type
-tcIfaceTupleTy sort is_promoted args
- = do { args' <- tcIfaceAppArgs args
- ; let arity = length args'
- ; base_tc <- tcTupleTyCon True sort arity
- ; case is_promoted of
- NotPromoted
- -> return (mkTyConApp base_tc args')
-
- IsPromoted
- -> do { let tc = promoteDataCon (tyConSingleDataCon base_tc)
- kind_args = map typeKind args'
- ; return (mkTyConApp tc (kind_args ++ args')) } }
-
-- See Note [Unboxed tuple RuntimeRep vars] in GHC.Core.TyCon
tcTupleTyCon :: Bool -- True <=> typechecking a *type* (vs. an expr)
-> TupleSort