[Git][ghc/ghc][wip/T21623-tycon] 2 commits: Wibbles
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Wed Nov 16 09:28:07 UTC 2022
Simon Peyton Jones pushed to branch wip/T21623-tycon at Glasgow Haskell Compiler / GHC
Commits:
81dd780e by Simon Peyton Jones at 2022-11-16T09:29:37+00:00
Wibbles
- - - - -
eb5b644b by Simon Peyton Jones at 2022-11-16T09:29:43+00:00
Update haddock submodule
- - - - -
4 changed files:
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/TyCl.hs
- utils/haddock
Changes:
=====================================
compiler/GHC/Core/TyCon.hs
=====================================
@@ -96,7 +96,7 @@ module GHC.Core.TyCon(
tyConFamInst_maybe, tyConFamInstSig_maybe, tyConFamilyCoercion_maybe,
tyConFamilyResVar_maybe,
synTyConDefn_maybe, synTyConRhs_maybe,
- famTyConFlav_maybe, famTcResVar,
+ famTyConFlav_maybe,
algTyConRhs,
newTyConRhs, newTyConEtadArity, newTyConEtadRhs,
unwrapNewTyCon_maybe, unwrapNewTyConEtad_maybe,
@@ -926,15 +926,15 @@ data TyConDetails =
-- arguments to the type constructor; see the use
-- of tyConArity in generaliseTcTyCon
- tcTyConScopedTyVars :: [(Name,TcTyVar)],
+ tctc_scoped_tvs :: [(Name,TcTyVar)],
-- ^ Scoped tyvars over the tycon's body
-- The range is always a skolem or TcTyVar, be
-- MonoTcTyCon only: see Note [Scoped tyvars in a TcTyCon]
- tcTyConIsPoly :: Bool, -- ^ Is this TcTyCon already generalized?
- -- Used only to make zonking more efficient
+ tctc_is_poly :: Bool, -- ^ Is this TcTyCon already generalized?
+ -- Used only to make zonking more efficient
- tcTyConFlavour :: TyConFlavour
+ tctc_flavour :: TyConFlavour
-- ^ What sort of 'TyCon' this represents.
}
@@ -1877,9 +1877,9 @@ mkTcTyCon :: Name
-> TyCon
mkTcTyCon name binders res_kind scoped_tvs poly flav
= mkTyCon name binders res_kind (constRoles binders Nominal) $
- TcTyCon { tcTyConScopedTyVars = scoped_tvs
- , tcTyConIsPoly = poly
- , tcTyConFlavour = flav }
+ TcTyCon { tctc_scoped_tvs = scoped_tvs
+ , tctc_is_poly = poly
+ , tctc_flavour = flav }
-- | No scoped type variables (to be used with mkTcTyCon).
noTcTyConScopedTyVars :: [(Name, TcTyVar)]
@@ -2345,29 +2345,6 @@ tyConCType_maybe (TyCon { tyConDetails = details })
| AlgTyCon { tyConCType = mb_ctype} <- details = mb_ctype
| otherwise = Nothing
--- | Is this a TcTyCon? (That is, one only used during type-checking?)
-isTcTyCon :: TyCon -> Bool
-isTcTyCon (TyCon { tyConDetails = details })
- | TcTyCon {} <- details = True
- | otherwise = False
-
-setTcTyConKind :: TyCon -> Kind -> TyCon
--- Update the Kind of a TcTyCon
--- The new kind is always a zonked version of its previous
--- kind, so we don't need to update any other fields.
--- See Note [The Purely Kinded Type Invariant (PKTI)] in GHC.Tc.Gen.HsType
-setTcTyConKind tc kind
- = assert (isMonoTcTyCon tc) $
- let tc' = tc { tyConKind = kind
- , tyConNullaryTy = mkNakedTyConTy tc' }
- -- See Note [Sharing nullary TyConApps]
- in tc'
-
-isMonoTcTyCon :: TyCon -> Bool
-isMonoTcTyCon (TyCon { tyConDetails = details })
- | TcTyCon { tcTyConIsPoly = is_poly } <- details = not is_poly
- | otherwise = False
-
-- | Does this 'TyCon' have a syntactically fixed RuntimeRep when fully applied,
-- as per Note [Fixed RuntimeRep] in GHC.Tc.Utils.Concrete?
--
@@ -2428,6 +2405,40 @@ isConcreteTyConFlavour = \case
BuiltInTypeFlavour -> True
PromotedDataConFlavour -> True
+{-
+-----------------------------------------------
+-- TcTyCon
+-----------------------------------------------
+-}
+
+-- | Is this a TcTyCon? (That is, one only used during type-checking?)
+isTcTyCon :: TyCon -> Bool
+isTcTyCon (TyCon { tyConDetails = details })
+ | TcTyCon {} <- details = True
+ | otherwise = False
+
+setTcTyConKind :: TyCon -> Kind -> TyCon
+-- Update the Kind of a TcTyCon
+-- The new kind is always a zonked version of its previous
+-- kind, so we don't need to update any other fields.
+-- See Note [The Purely Kinded Type Invariant (PKTI)] in GHC.Tc.Gen.HsType
+setTcTyConKind tc kind
+ = assert (isMonoTcTyCon tc) $
+ let tc' = tc { tyConKind = kind
+ , tyConNullaryTy = mkNakedTyConTy tc' }
+ -- See Note [Sharing nullary TyConApps]
+ in tc'
+
+isMonoTcTyCon :: TyCon -> Bool
+isMonoTcTyCon (TyCon { tyConDetails = details })
+ | TcTyCon { tctc_is_poly = is_poly } <- details = not is_poly
+ | otherwise = False
+
+tcTyConScopedTyVars :: TyCon -> [(Name,TcTyVar)]
+tcTyConScopedTyVars tc@(TyCon { tyConDetails = details })
+ | TcTyCon { tctc_scoped_tvs = scoped_tvs } <- details = scoped_tvs
+ | otherwise = pprPanic "tcTyConScopedTyVars" (ppr tc)
+
{-
-----------------------------------------------
-- Expand type-constructor applications
@@ -2801,7 +2812,7 @@ tyConFlavour (TyCon { tyConDetails = details })
| SynonymTyCon {} <- details = TypeSynonymFlavour
| PrimTyCon {} <- details = BuiltInTypeFlavour
| PromotedDataCon {} <- details = PromotedDataConFlavour
- | TcTyCon { tcTyConFlavour = flav } <-details = flav
+ | TcTyCon { tctc_flavour = flav } <-details = flav
-- | Can this flavour of 'TyCon' appear unsaturated?
tcFlavourMustBeSaturated :: TyConFlavour -> Bool
=====================================
compiler/GHC/Tc/Gen/Splice.hs
=====================================
@@ -2121,7 +2121,7 @@ reifyTyCon tc
| isTypeFamilyTyCon tc
= do { let tvs = tyConTyVars tc
res_kind = tyConResKind tc
- resVar = famTcResVar tc
+ resVar = tyConFamilyResVar_maybe tc
; kind' <- reifyKind res_kind
; let (resultSig, injectivity) =
=====================================
compiler/GHC/Tc/TyCl.hs
=====================================
@@ -5177,8 +5177,7 @@ addVDQNote :: TcTyCon -> TcM a -> TcM a
-- See Note [Inferring visible dependent quantification]
-- Only types without a signature (CUSK or SAK) here
addVDQNote tycon thing_inside
- | assertPpr (isTcTyCon tycon) (ppr tycon) $
- assertPpr (not (tcTyConIsPoly tycon)) (ppr tycon $$ ppr tc_kind)
+ | assertPpr (isMonoTcTyCon tycon) (ppr tycon $$ ppr tc_kind)
has_vdq
= addLandmarkErrCtxt vdq_warning thing_inside
| otherwise
=====================================
utils/haddock
=====================================
@@ -1 +1 @@
-Subproject commit 2ffde83344bab8ed0aee3e8ef46f43856c7ca6ef
+Subproject commit 9f3d49deb0463294c86af35d7bda5e577360298f
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d8dc40e9a9e51acc2626eb5a3b0b30c0190e3c06...eb5b644b3805c13f8be09b1bb0fc80e30b9ac686
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d8dc40e9a9e51acc2626eb5a3b0b30c0190e3c06...eb5b644b3805c13f8be09b1bb0fc80e30b9ac686
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221116/333d1992/attachment-0001.html>
More information about the ghc-commits
mailing list