summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2021-10-05 07:23:34 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2021-10-05 07:23:36 -0400
commitee58d086a233eb38ad88355fc298252b9130b5c6 (patch)
treed1eca523121a91e9fb7d2e5b4774056653348c41
parent298df16d7005a3cead2df1cc7280509ddf7c6c76 (diff)
downloadhaskell-ee58d086a233eb38ad88355fc298252b9130b5c6.tar.gz
Remove the Maybe in primRepName's typewip/T20482
There's no need for this `Maybe`, as it will always be instantiated to `Just` in practice. Fixes #20482.
-rw-r--r--compiler/GHC/Core/TyCon.hs17
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/GHC/Core/TyCon.hs b/compiler/GHC/Core/TyCon.hs
index 512ac4737c..9001c3bc43 100644
--- a/compiler/GHC/Core/TyCon.hs
+++ b/compiler/GHC/Core/TyCon.hs
@@ -910,8 +910,9 @@ data TyCon
-- e.g. @RealWorld@
-- Only relevant if tyConKind = *
- primRepName :: Maybe TyConRepName -- Only relevant for kind TyCons
- -- i.e, *, #, ?
+ primRepName :: TyConRepName -- ^ The 'Typeable' representation.
+ -- A cached version of
+ -- @'mkPrelTyConRepName' ('tyConName' tc)@.
}
-- | Represents promoted data constructor.
@@ -1388,8 +1389,8 @@ type TyConRepName = Name
tyConRepName_maybe :: TyCon -> Maybe TyConRepName
tyConRepName_maybe (FunTyCon { tcRepName = rep_nm })
= Just rep_nm
-tyConRepName_maybe (PrimTyCon { primRepName = mb_rep_nm })
- = mb_rep_nm
+tyConRepName_maybe (PrimTyCon { primRepName = rep_nm })
+ = Just rep_nm
tyConRepName_maybe (AlgTyCon { algTcParent = parent })
| VanillaAlgTyCon rep_nm <- parent = Just rep_nm
| ClassTyCon _ rep_nm <- parent = Just rep_nm
@@ -1864,7 +1865,7 @@ mkPrimTyCon :: Name -> [TyConBinder]
-> Kind -- ^ /result/ kind, never representation-polymorphic
-> [Role] -> TyCon
mkPrimTyCon name binders res_kind roles
- = mkPrimTyCon' name binders res_kind roles True (Just $ mkPrelTyConRepName name)
+ = mkPrimTyCon' name binders res_kind roles True (mkPrelTyConRepName name)
-- | Kind constructors
mkKindTyCon :: Name -> [TyConBinder]
@@ -1873,14 +1874,14 @@ mkKindTyCon :: Name -> [TyConBinder]
mkKindTyCon name binders res_kind roles rep_nm
= tc
where
- tc = mkPrimTyCon' name binders res_kind roles False (Just rep_nm)
+ tc = mkPrimTyCon' name binders res_kind roles False rep_nm
-- | Create a lifted primitive 'TyCon' such as @RealWorld@
mkLiftedPrimTyCon :: Name -> [TyConBinder]
-> Kind -- ^ /result/ kind
-> [Role] -> TyCon
mkLiftedPrimTyCon name binders res_kind roles
- = mkPrimTyCon' name binders res_kind roles False (Just rep_nm)
+ = mkPrimTyCon' name binders res_kind roles False rep_nm
where rep_nm = mkPrelTyConRepName name
mkPrimTyCon' :: Name -> [TyConBinder]
@@ -1888,7 +1889,7 @@ mkPrimTyCon' :: Name -> [TyConBinder]
-- (If you need a representation-polymorphic PrimTyCon,
-- change isTcLevPoly.)
-> [Role]
- -> Bool -> Maybe TyConRepName -> TyCon
+ -> Bool -> TyConRepName -> TyCon
mkPrimTyCon' name binders res_kind roles is_unlifted rep_nm
= let tc =
PrimTyCon {