diff options
Diffstat (limited to 'libraries/ghc-prim/GHC')
-rw-r--r-- | libraries/ghc-prim/GHC/Types.hs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs index f558619ac1..59edeec8af 100644 --- a/libraries/ghc-prim/GHC/Types.hs +++ b/libraries/ghc-prim/GHC/Types.hs @@ -33,7 +33,9 @@ module GHC.Types ( Symbol, Any, type (~~), Coercible, - TYPE, RuntimeRep(..), Type, Constraint, + TYPE, Levity(..), RuntimeRep(..), + LiftedRep, UnliftedRep, + Type, UnliftedType, Constraint, -- The historical type * should ideally be written as -- `type *`, without the parentheses. But that's a true -- pain to parse, and for little gain. @@ -85,8 +87,17 @@ type (->) = FUN 'Many -- | The kind of constraints, like @Show a@ data Constraint +-- | The runtime representation of lifted types. +type LiftedRep = 'BoxedRep 'Lifted + +-- | The runtime representation of unlifted types. +type UnliftedRep = 'BoxedRep 'Unlifted + -- | The kind of types with lifted values. For example @Int :: Type@. -type Type = TYPE 'LiftedRep +type Type = TYPE LiftedRep + +-- | The kind of types with unlifted values. For example @Int# :: UnliftedType@. +type UnliftedType = TYPE UnliftedRep data Multiplicity = Many | One @@ -410,6 +421,8 @@ data SPEC = SPEC | SPEC2 * * ********************************************************************* -} +-- | Whether a boxed type is lifted or unlifted. +data Levity = Lifted | Unlifted -- | GHC maintains a property that the kind of all inhabited types -- (as distinct from type constructors or type-level data) tells us @@ -425,8 +438,7 @@ data SPEC = SPEC | SPEC2 data RuntimeRep = VecRep VecCount VecElem -- ^ a SIMD vector type | TupleRep [RuntimeRep] -- ^ An unboxed tuple of the given reps | SumRep [RuntimeRep] -- ^ An unboxed sum of the given reps - | LiftedRep -- ^ lifted; represented by a pointer - | UnliftedRep -- ^ unlifted; represented by a pointer + | BoxedRep Levity -- ^ boxed; represented by a pointer | IntRep -- ^ signed, word-sized value | Int8Rep -- ^ signed, 8-bit value | Int16Rep -- ^ signed, 16-bit value @@ -444,6 +456,7 @@ data RuntimeRep = VecRep VecCount VecElem -- ^ a SIMD vector type -- RuntimeRep is intimately tied to TyCon.RuntimeRep (in GHC proper). See -- Note [RuntimeRep and PrimRep] in RepType. -- See also Note [Wiring in RuntimeRep] in GHC.Builtin.Types +-- See also Note [TYPE and RuntimeRep] in GHC.Builtin.Type.Prim -- | Length of a SIMD vector type data VecCount = Vec2 |