diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-12-15 11:21:06 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-12-15 11:21:06 -0500 |
commit | 331f556886e611af3d2633d1cebb868574a2aa13 (patch) | |
tree | cc38fae1d51227ca86677435aaee311c2e6bbbe0 /compiler/GHC/Builtin | |
parent | 535dae66271af0ce4ab9c0a772614b700bc4c92a (diff) | |
download | haskell-331f556886e611af3d2633d1cebb868574a2aa13.tar.gz |
Revert "Implement BoxedRep proposal"
This was inadvertently merged.
This reverts commit 6c2eb2232b39ff4720fda0a4a009fb6afbc9dcea.
Diffstat (limited to 'compiler/GHC/Builtin')
-rw-r--r-- | compiler/GHC/Builtin/Names.hs | 65 | ||||
-rw-r--r-- | compiler/GHC/Builtin/Types.hs | 137 | ||||
-rw-r--r-- | compiler/GHC/Builtin/Types.hs-boot | 11 | ||||
-rw-r--r-- | compiler/GHC/Builtin/Types/Prim.hs | 22 |
4 files changed, 68 insertions, 167 deletions
diff --git a/compiler/GHC/Builtin/Names.hs b/compiler/GHC/Builtin/Names.hs index caa577a877..cf0f72c50f 100644 --- a/compiler/GHC/Builtin/Names.hs +++ b/compiler/GHC/Builtin/Names.hs @@ -1767,7 +1767,7 @@ statePrimTyConKey, stableNamePrimTyConKey, stableNameTyConKey, wordPrimTyConKey, wordTyConKey, word8PrimTyConKey, word8TyConKey, word16PrimTyConKey, word16TyConKey, word32PrimTyConKey, word32TyConKey, word64PrimTyConKey, word64TyConKey, - anyBoxConKey, kindConKey, boxityConKey, + liftedConKey, unliftedConKey, anyBoxConKey, kindConKey, boxityConKey, typeConKey, threadIdPrimTyConKey, bcoPrimTyConKey, ptrTyConKey, funPtrTyConKey, tVarPrimTyConKey, eqPrimTyConKey, eqReprPrimTyConKey, eqPhantPrimTyConKey, @@ -1790,6 +1790,8 @@ word32PrimTyConKey = mkPreludeTyConUnique 65 word32TyConKey = mkPreludeTyConUnique 66 word64PrimTyConKey = mkPreludeTyConUnique 67 word64TyConKey = mkPreludeTyConUnique 68 +liftedConKey = mkPreludeTyConUnique 69 +unliftedConKey = mkPreludeTyConUnique 70 anyBoxConKey = mkPreludeTyConUnique 71 kindConKey = mkPreludeTyConUnique 72 boxityConKey = mkPreludeTyConUnique 73 @@ -1805,17 +1807,15 @@ eitherTyConKey :: Unique eitherTyConKey = mkPreludeTyConUnique 84 -- Kind constructors -liftedTypeKindTyConKey, tYPETyConKey, liftedRepTyConKey, - constraintKindTyConKey, levityTyConKey, runtimeRepTyConKey, +liftedTypeKindTyConKey, tYPETyConKey, + constraintKindTyConKey, runtimeRepTyConKey, vecCountTyConKey, vecElemTyConKey :: Unique liftedTypeKindTyConKey = mkPreludeTyConUnique 87 tYPETyConKey = mkPreludeTyConUnique 88 constraintKindTyConKey = mkPreludeTyConUnique 92 -levityTyConKey = mkPreludeTyConUnique 94 runtimeRepTyConKey = mkPreludeTyConUnique 95 vecCountTyConKey = mkPreludeTyConUnique 96 vecElemTyConKey = mkPreludeTyConUnique 97 -liftedRepTyConKey = mkPreludeTyConUnique 98 pluginTyConKey, frontendPluginTyConKey :: Unique pluginTyConKey = mkPreludeTyConUnique 102 @@ -2073,60 +2073,58 @@ metaDataDataConKey = mkPreludeDataConUnique 68 metaConsDataConKey = mkPreludeDataConUnique 69 metaSelDataConKey = mkPreludeDataConUnique 70 -vecRepDataConKey, tupleRepDataConKey, sumRepDataConKey, - boxedRepDataConKey :: Unique +vecRepDataConKey, tupleRepDataConKey, sumRepDataConKey :: Unique vecRepDataConKey = mkPreludeDataConUnique 71 tupleRepDataConKey = mkPreludeDataConUnique 72 sumRepDataConKey = mkPreludeDataConUnique 73 -boxedRepDataConKey = mkPreludeDataConUnique 74 -- See Note [Wiring in RuntimeRep] in GHC.Builtin.Types --- Includes all nullary-data-constructor reps. Does not --- include BoxedRep, VecRep, SumRep, TupleRep. -runtimeRepSimpleDataConKeys :: [Unique] -runtimeRepSimpleDataConKeys - = map mkPreludeDataConUnique [75..87] +runtimeRepSimpleDataConKeys, unliftedSimpleRepDataConKeys, unliftedRepDataConKeys :: [Unique] +liftedRepDataConKey :: Unique +runtimeRepSimpleDataConKeys@(liftedRepDataConKey : unliftedSimpleRepDataConKeys) + = map mkPreludeDataConUnique [74..88] -liftedDataConKey,unliftedDataConKey :: Unique -liftedDataConKey = mkPreludeDataConUnique 88 -unliftedDataConKey = mkPreludeDataConUnique 89 +unliftedRepDataConKeys = vecRepDataConKey : + tupleRepDataConKey : + sumRepDataConKey : + unliftedSimpleRepDataConKeys -- See Note [Wiring in RuntimeRep] in GHC.Builtin.Types -- VecCount vecCountDataConKeys :: [Unique] -vecCountDataConKeys = map mkPreludeDataConUnique [90..95] +vecCountDataConKeys = map mkPreludeDataConUnique [89..94] -- See Note [Wiring in RuntimeRep] in GHC.Builtin.Types -- VecElem vecElemDataConKeys :: [Unique] -vecElemDataConKeys = map mkPreludeDataConUnique [96..105] +vecElemDataConKeys = map mkPreludeDataConUnique [95..104] -- Typeable things kindRepTyConAppDataConKey, kindRepVarDataConKey, kindRepAppDataConKey, kindRepFunDataConKey, kindRepTYPEDataConKey, kindRepTypeLitSDataConKey, kindRepTypeLitDDataConKey :: Unique -kindRepTyConAppDataConKey = mkPreludeDataConUnique 106 -kindRepVarDataConKey = mkPreludeDataConUnique 107 -kindRepAppDataConKey = mkPreludeDataConUnique 108 -kindRepFunDataConKey = mkPreludeDataConUnique 109 -kindRepTYPEDataConKey = mkPreludeDataConUnique 110 -kindRepTypeLitSDataConKey = mkPreludeDataConUnique 111 -kindRepTypeLitDDataConKey = mkPreludeDataConUnique 112 +kindRepTyConAppDataConKey = mkPreludeDataConUnique 105 +kindRepVarDataConKey = mkPreludeDataConUnique 106 +kindRepAppDataConKey = mkPreludeDataConUnique 107 +kindRepFunDataConKey = mkPreludeDataConUnique 108 +kindRepTYPEDataConKey = mkPreludeDataConUnique 109 +kindRepTypeLitSDataConKey = mkPreludeDataConUnique 110 +kindRepTypeLitDDataConKey = mkPreludeDataConUnique 111 typeLitSymbolDataConKey, typeLitNatDataConKey :: Unique -typeLitSymbolDataConKey = mkPreludeDataConUnique 113 -typeLitNatDataConKey = mkPreludeDataConUnique 114 +typeLitSymbolDataConKey = mkPreludeDataConUnique 112 +typeLitNatDataConKey = mkPreludeDataConUnique 113 -- Unsafe equality unsafeReflDataConKey :: Unique -unsafeReflDataConKey = mkPreludeDataConUnique 115 +unsafeReflDataConKey = mkPreludeDataConUnique 114 -- Multiplicity oneDataConKey, manyDataConKey :: Unique -oneDataConKey = mkPreludeDataConUnique 116 -manyDataConKey = mkPreludeDataConUnique 117 +oneDataConKey = mkPreludeDataConUnique 115 +manyDataConKey = mkPreludeDataConUnique 116 -- ghc-bignum integerISDataConKey, integerINDataConKey, integerIPDataConKey, @@ -2366,16 +2364,14 @@ mkTrFunKey = mkPreludeMiscIdUnique 510 -- Representations for primitive types trTYPEKey - , trTYPE'PtrRepLiftedKey + ,trTYPE'PtrRepLiftedKey , trRuntimeRepKey , tr'PtrRepLiftedKey - , trLiftedRepKey :: Unique trTYPEKey = mkPreludeMiscIdUnique 511 trTYPE'PtrRepLiftedKey = mkPreludeMiscIdUnique 512 trRuntimeRepKey = mkPreludeMiscIdUnique 513 tr'PtrRepLiftedKey = mkPreludeMiscIdUnique 514 -trLiftedRepKey = mkPreludeMiscIdUnique 515 -- KindReps for common cases starKindRepKey, starArrStarKindRepKey, starArrStarArrStarKindRepKey :: Unique @@ -2605,5 +2601,4 @@ pretendNameIsInScope :: Name -> Bool pretendNameIsInScope n = any (n `hasKey`) [ liftedTypeKindTyConKey, tYPETyConKey - , runtimeRepTyConKey, boxedRepDataConKey - , liftedDataConKey ] + , runtimeRepTyConKey, liftedRepDataConKey ] diff --git a/compiler/GHC/Builtin/Types.hs b/compiler/GHC/Builtin/Types.hs index 3361853611..3339e0a020 100644 --- a/compiler/GHC/Builtin/Types.hs +++ b/compiler/GHC/Builtin/Types.hs @@ -99,9 +99,8 @@ module GHC.Builtin.Types ( typeSymbolKindCon, typeSymbolKind, isLiftedTypeKindTyConName, liftedTypeKind, typeToTypeKind, constraintKind, - liftedRepTyCon, liftedTypeKindTyCon, constraintKindTyCon, constraintKindTyConName, - liftedTypeKindTyConName, liftedRepTyConName, + liftedTypeKindTyConName, -- * Equality predicates heqTyCon, heqTyConName, heqClass, heqDataCon, @@ -109,15 +108,13 @@ module GHC.Builtin.Types ( coercibleTyCon, coercibleTyConName, coercibleDataCon, coercibleClass, -- * RuntimeRep and friends - runtimeRepTyCon, levityTyCon, vecCountTyCon, vecElemTyCon, + runtimeRepTyCon, vecCountTyCon, vecElemTyCon, - boxedRepDataConTyCon, - runtimeRepTy, liftedRepTy, unliftedRepTy, + runtimeRepTy, liftedRepTy, liftedRepDataCon, liftedRepDataConTyCon, vecRepDataConTyCon, tupleRepDataConTyCon, sumRepDataConTyCon, - liftedDataConTyCon, unliftedDataConTyCon, - + liftedRepDataConTy, unliftedRepDataConTy, intRepDataConTy, int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy, wordRepDataConTy, @@ -215,41 +212,6 @@ to this Note, so a search for this Note's name should find all the lists. See also Note [Getting from RuntimeRep to PrimRep] in GHC.Types.RepType. - -Note [Wired-in Types and Type Constructors] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This module include a lot of wired-in types and type constructors. Here, -these are presented in a tabular format to make it easier to find the -wired-in type identifier corresponding to a known Haskell type. Data -constructors are nested under their corresponding types with two spaces -of indentation. - -Identifier Type Haskell name Notes ----------------------------------------------------------------------------- -liftedTypeKindTyCon TyCon GHC.Types.Type Synonym for: TYPE LiftedRep -liftedRepTyCon TyCon GHC.Types.LiftedRep Synonym for: 'BoxedRep 'Lifted -levityTyCon TyCon GHC.Types.Levity Data type - liftedDataConTyCon TyCon GHC.Types.Lifted Data constructor - unliftedDataConTyCon TyCon GHC.Types.Unlifted Data constructor -vecCountTyCon TyCon GHC.Types.VecCount Data type - vec2DataConTy Type GHC.Types.Vec2 Data constructor - vec4DataConTy Type GHC.Types.Vec4 Data constructor - vec8DataConTy Type GHC.Types.Vec8 Data constructor - vec16DataConTy Type GHC.Types.Vec16 Data constructor - vec32DataConTy Type GHC.Types.Vec32 Data constructor - vec64DataConTy Type GHC.Types.Vec64 Data constructor -runtimeRepTyCon TyCon GHC.Types.RuntimeRep Data type - boxedRepDataConTyCon TyCon GHC.Types.BoxedRep Data constructor - intRepDataConTy Type GHC.Types.IntRep Data constructor - doubleRepDataConTy Type GHC.Types.DoubleRep Data constructor - floatRepDataConTy Type GHC.Types.FloatRep Data constructor -boolTyCon TyCon GHC.Types.Bool Data type - trueDataCon DataCon GHC.Types.True Data constructor - falseDataCon DataCon GHC.Types.False Data constructor - promotedTrueDataCon TyCon GHC.Types.True Data constructor - promotedFalseDataCon TyCon GHC.Types.False Data constructor - ************************************************************************ * * \subsection{Wired in type constructors} @@ -258,10 +220,8 @@ boolTyCon TyCon GHC.Types.Bool Data type If you change which things are wired in, make sure you change their names in GHC.Builtin.Names, so they use wTcQual, wDataQual, etc - -} - -- This list is used only to define GHC.Builtin.Utils.wiredInThings. That in turn -- is used to initialise the name environment carried around by the renamer. -- This means that if we look up the name of a TyCon (or its implicit binders) @@ -300,7 +260,6 @@ wiredInTyCons = [ -- Units are not treated like other tuples, because they , coercibleTyCon , typeSymbolKindCon , runtimeRepTyCon - , levityTyCon , vecCountTyCon , vecElemTyCon , constraintKindTyCon @@ -308,7 +267,6 @@ wiredInTyCons = [ -- Units are not treated like other tuples, because they , multiplicityTyCon , naturalTyCon , integerTyCon - , liftedRepTyCon ] mkWiredInTyConName :: BuiltInSyntax -> Module -> FastString -> Unique -> TyCon -> Name @@ -525,9 +483,8 @@ typeSymbolKindConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Symbol") constraintKindTyConName :: Name constraintKindTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Constraint") constraintKindTyConKey constraintKindTyCon -liftedTypeKindTyConName, liftedRepTyConName :: Name +liftedTypeKindTyConName :: Name liftedTypeKindTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Type") liftedTypeKindTyConKey liftedTypeKindTyCon -liftedRepTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "LiftedRep") liftedRepTyConKey liftedRepTyCon multiplicityTyConName :: Name multiplicityTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Multiplicity") @@ -543,24 +500,18 @@ manyDataConName = mkWiredInDataConName BuiltInSyntax gHC_TYPES (fsLit "Many") ma -- reported. Making them built-in make it so that they are always considered in -- scope. -runtimeRepTyConName, vecRepDataConName, tupleRepDataConName, sumRepDataConName, boxedRepDataConName :: Name +runtimeRepTyConName, vecRepDataConName, tupleRepDataConName, sumRepDataConName :: Name runtimeRepTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "RuntimeRep") runtimeRepTyConKey runtimeRepTyCon vecRepDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "VecRep") vecRepDataConKey vecRepDataCon tupleRepDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "TupleRep") tupleRepDataConKey tupleRepDataCon sumRepDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "SumRep") sumRepDataConKey sumRepDataCon -boxedRepDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "BoxedRep") boxedRepDataConKey boxedRepDataCon - -levityTyConName, liftedDataConName, unliftedDataConName :: Name -levityTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Levity") levityTyConKey levityTyCon -liftedDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "Lifted") liftedDataConKey liftedDataCon -unliftedDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "Unlifted") unliftedDataConKey unliftedDataCon - -- See Note [Wiring in RuntimeRep] runtimeRepSimpleDataConNames :: [Name] runtimeRepSimpleDataConNames = zipWith3Lazy mk_special_dc_name - [ fsLit "IntRep" + [ fsLit "LiftedRep", fsLit "UnliftedRep" + , fsLit "IntRep" , fsLit "Int8Rep", fsLit "Int16Rep", fsLit "Int32Rep", fsLit "Int64Rep" , fsLit "WordRep" , fsLit "Word8Rep", fsLit "Word16Rep", fsLit "Word32Rep", fsLit "Word64Rep" @@ -1462,43 +1413,16 @@ runtimeRepTy = mkTyConTy runtimeRepTyCon -- Type synonyms; see Note [TYPE and RuntimeRep] in GHC.Builtin.Types.Prim -- and Note [Prefer Type over TYPE 'LiftedRep] in GHC.Core.TyCo.Rep. --- type Type = TYPE ('BoxedRep 'Lifted) --- type LiftedRep = 'BoxedRep 'Lifted +-- type Type = tYPE 'LiftedRep liftedTypeKindTyCon :: TyCon liftedTypeKindTyCon = buildSynTyCon liftedTypeKindTyConName [] liftedTypeKind [] rhs - where rhs = TyCoRep.TyConApp tYPETyCon [mkTyConApp liftedRepTyCon []] - -liftedRepTyCon :: TyCon -liftedRepTyCon = buildSynTyCon - liftedRepTyConName [] runtimeRepTy [] liftedRepTy + where rhs = TyCoRep.TyConApp tYPETyCon [liftedRepTy] runtimeRepTyCon :: TyCon runtimeRepTyCon = pcTyCon runtimeRepTyConName Nothing [] - (vecRepDataCon : tupleRepDataCon : - sumRepDataCon : boxedRepDataCon : runtimeRepSimpleDataCons) - -levityTyCon :: TyCon -levityTyCon = pcTyCon levityTyConName Nothing [] [liftedDataCon,unliftedDataCon] - -liftedDataCon, unliftedDataCon :: DataCon -liftedDataCon = pcSpecialDataCon liftedDataConName - [] levityTyCon LiftedInfo -unliftedDataCon = pcSpecialDataCon unliftedDataConName - [] levityTyCon UnliftedInfo - -boxedRepDataCon :: DataCon -boxedRepDataCon = pcSpecialDataCon boxedRepDataConName - [ mkTyConTy levityTyCon ] runtimeRepTyCon (RuntimeRep prim_rep_fun) - where - -- See Note [Getting from RuntimeRep to PrimRep] in RepType - prim_rep_fun [lev] - = case tyConRuntimeRepInfo (tyConAppTyCon lev) of - LiftedInfo -> [LiftedRep] - UnliftedInfo -> [UnliftedRep] - _ -> pprPanic "boxedRepDataCon" (ppr lev) - prim_rep_fun args - = pprPanic "boxedRepDataCon" (ppr args) + (vecRepDataCon : tupleRepDataCon : + sumRepDataCon : runtimeRepSimpleDataCons) vecRepDataCon :: DataCon vecRepDataCon = pcSpecialDataCon vecRepDataConName [ mkTyConTy vecCountTyCon @@ -1553,9 +1477,11 @@ sumRepDataConTyCon = promoteDataCon sumRepDataCon -- See Note [Wiring in RuntimeRep] -- See Note [Getting from RuntimeRep to PrimRep] in GHC.Types.RepType runtimeRepSimpleDataCons :: [DataCon] -runtimeRepSimpleDataCons +liftedRepDataCon :: DataCon +runtimeRepSimpleDataCons@(liftedRepDataCon : _) = zipWithLazy mk_runtime_rep_dc - [ IntRep + [ LiftedRep, UnliftedRep + , IntRep , Int8Rep, Int16Rep, Int32Rep, Int64Rep , WordRep , Word8Rep, Word16Rep, Word32Rep, Word64Rep @@ -1568,13 +1494,15 @@ runtimeRepSimpleDataCons = pcSpecialDataCon name [] runtimeRepTyCon (RuntimeRep (\_ -> [primrep])) -- See Note [Wiring in RuntimeRep] -intRepDataConTy, +liftedRepDataConTy, unliftedRepDataConTy, + intRepDataConTy, int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy, wordRepDataConTy, word8RepDataConTy, word16RepDataConTy, word32RepDataConTy, word64RepDataConTy, addrRepDataConTy, floatRepDataConTy, doubleRepDataConTy :: Type -[intRepDataConTy, +[liftedRepDataConTy, unliftedRepDataConTy, + intRepDataConTy, int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy, wordRepDataConTy, word8RepDataConTy, word16RepDataConTy, word32RepDataConTy, word64RepDataConTy, @@ -1626,29 +1554,12 @@ int8ElemRepDataConTy, int16ElemRepDataConTy, int32ElemRepDataConTy, doubleElemRepDataConTy] = map (mkTyConTy . promoteDataCon) vecElemDataCons +liftedRepDataConTyCon :: TyCon +liftedRepDataConTyCon = promoteDataCon liftedRepDataCon -liftedDataConTyCon :: TyCon -liftedDataConTyCon = promoteDataCon liftedDataCon - -unliftedDataConTyCon :: TyCon -unliftedDataConTyCon = promoteDataCon unliftedDataCon - -liftedDataConTy :: Type -liftedDataConTy = mkTyConTy liftedDataConTyCon - -unliftedDataConTy :: Type -unliftedDataConTy = mkTyConTy unliftedDataConTyCon - -boxedRepDataConTyCon :: TyCon -boxedRepDataConTyCon = promoteDataCon boxedRepDataCon - --- The type ('BoxedRep 'LiftedRep) +-- The type ('LiftedRep) liftedRepTy :: Type -liftedRepTy = mkTyConApp boxedRepDataConTyCon [liftedDataConTy] - --- The type ('BoxedRep 'UnliftedRep) -unliftedRepTy :: Type -unliftedRepTy = mkTyConApp boxedRepDataConTyCon [unliftedDataConTy] +liftedRepTy = liftedRepDataConTy {- ********************************************************************* * * diff --git a/compiler/GHC/Builtin/Types.hs-boot b/compiler/GHC/Builtin/Types.hs-boot index 222d88fdf7..000df212c3 100644 --- a/compiler/GHC/Builtin/Types.hs-boot +++ b/compiler/GHC/Builtin/Types.hs-boot @@ -20,16 +20,13 @@ liftedTypeKindTyCon :: TyCon constraintKind :: Kind -runtimeRepTyCon, levityTyCon, vecCountTyCon, vecElemTyCon :: TyCon +runtimeRepTyCon, vecCountTyCon, vecElemTyCon :: TyCon runtimeRepTy :: Type -boxedRepDataConTyCon :: TyCon -liftedDataConTyCon :: TyCon -vecRepDataConTyCon, tupleRepDataConTyCon :: TyCon +liftedRepDataConTyCon, vecRepDataConTyCon, tupleRepDataConTyCon :: TyCon -liftedRepTy, unliftedRepTy :: Type - -intRepDataConTy, +liftedRepDataConTy, unliftedRepDataConTy, + intRepDataConTy, int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy, wordRepDataConTy, word8RepDataConTy, word16RepDataConTy, word32RepDataConTy, word64RepDataConTy, diff --git a/compiler/GHC/Builtin/Types/Prim.hs b/compiler/GHC/Builtin/Types/Prim.hs index e748258769..61f341a0bb 100644 --- a/compiler/GHC/Builtin/Types/Prim.hs +++ b/compiler/GHC/Builtin/Types/Prim.hs @@ -98,7 +98,7 @@ import GHC.Prelude import {-# SOURCE #-} GHC.Builtin.Types ( runtimeRepTy, unboxedTupleKind, liftedTypeKind , vecRepDataConTyCon, tupleRepDataConTyCon - , liftedRepTy, unliftedRepTy + , liftedRepDataConTy, unliftedRepDataConTy , intRepDataConTy , int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy , wordRepDataConTy @@ -364,7 +364,7 @@ alphaTy, betaTy, gammaTy, deltaTy :: Type (alphaTy:betaTy:gammaTy:deltaTy:_) = alphaTys alphaTyVarsUnliftedRep :: [TyVar] -alphaTyVarsUnliftedRep = mkTemplateTyVars $ repeat (tYPE unliftedRepTy) +alphaTyVarsUnliftedRep = mkTemplateTyVars $ repeat (tYPE unliftedRepDataConTy) alphaTyVarUnliftedRep :: TyVar (alphaTyVarUnliftedRep:_) = alphaTyVarsUnliftedRep @@ -451,28 +451,26 @@ Note [TYPE and RuntimeRep] All types that classify values have a kind of the form (TYPE rr), where data RuntimeRep -- Defined in ghc-prim:GHC.Types - = BoxedRep Levity + = LiftedRep + | UnliftedRep | IntRep | FloatRep .. etc .. - data Levity = Lifted | Unlifted - rr :: RuntimeRep TYPE :: RuntimeRep -> TYPE 'LiftedRep -- Built in So for example: - Int :: TYPE ('BoxedRep 'Lifted) - Array# Int :: TYPE ('BoxedRep 'Unlifted) + Int :: TYPE 'LiftedRep + Array# Int :: TYPE 'UnliftedRep Int# :: TYPE 'IntRep Float# :: TYPE 'FloatRep - Maybe :: TYPE ('BoxedRep 'Lifted) -> TYPE ('BoxedRep 'Lifted) + Maybe :: TYPE 'LiftedRep -> TYPE 'LiftedRep (# , #) :: TYPE r1 -> TYPE r2 -> TYPE (TupleRep [r1, r2]) We abbreviate '*' specially: - type LiftedRep = 'BoxedRep 'Lifted - type * = TYPE LiftedRep + type * = TYPE 'LiftedRep The 'rr' parameter tells us how the value is represented at runtime. @@ -579,8 +577,8 @@ pcPrimTyCon name roles rep primRepToRuntimeRep :: PrimRep -> Type primRepToRuntimeRep rep = case rep of VoidRep -> TyConApp tupleRepDataConTyCon [mkPromotedListTy runtimeRepTy []] - LiftedRep -> liftedRepTy - UnliftedRep -> unliftedRepTy + LiftedRep -> liftedRepDataConTy + UnliftedRep -> unliftedRepDataConTy IntRep -> intRepDataConTy Int8Rep -> int8RepDataConTy Int16Rep -> int16RepDataConTy |