| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
GHC.Types.RepType
Synopsis
- type UnaryType = Type
- type NvUnaryType = Type
- isNvUnaryType :: Type -> Bool
- unwrapType :: Type -> Type
- isVoidTy :: Type -> Bool
- typePrimRep :: HasDebugCallStack => Type -> [PrimRep]
- typePrimRep1 :: HasDebugCallStack => UnaryType -> PrimRep
- typeMonoPrimRep_maybe :: Type -> Maybe [PrimRep]
- runtimeRepPrimRep :: HasDebugCallStack => SDoc -> Type -> [PrimRep]
- typePrimRepArgs :: HasDebugCallStack => Type -> [PrimRep]
- data PrimRep
- primRepToType :: PrimRep -> Type
- countFunRepArgs :: Arity -> Type -> RepArity
- countConRepArgs :: DataCon -> RepArity
- tyConPrimRep :: HasDebugCallStack => TyCon -> [PrimRep]
- tyConPrimRep1 :: HasDebugCallStack => TyCon -> PrimRep
- ubxSumRepType :: [[PrimRep]] -> [SlotTy]
- layoutUbxSum :: SortedSlotTys -> [SlotTy] -> [Int]
- typeSlotTy :: UnaryType -> Maybe SlotTy
- data SlotTy
- slotPrimRep :: SlotTy -> PrimRep
- primRepSlot :: PrimRep -> SlotTy
Code generator views onto Types
type NvUnaryType = Type #
isNvUnaryType :: Type -> Bool #
unwrapType :: Type -> Type #
Gets rid of the stuff that prevents us from understanding the runtime representation of a type. Including: 1. Casts 2. Newtypes 3. Foralls 4. Synonyms But not type/data families, because we don't have the envs to hand.
Predicates on types
Type representation for the code generator
typePrimRep :: HasDebugCallStack => Type -> [PrimRep] #
typePrimRep1 :: HasDebugCallStack => UnaryType -> PrimRep #
Like typePrimRep, but assumes that there is precisely one PrimRep output;
an empty list of PrimReps becomes a VoidRep.
This assumption holds after unarise, see Note [Post-unarisation invariants].
Before unarise it may or may not hold.
See also Note [RuntimeRep and PrimRep] and Note [VoidRep]
typeMonoPrimRep_maybe :: Type -> Maybe [PrimRep] #
Like typePrimRep, but returns Nothing instead of panicking, when
- The
tywas not of formTYPE rep repwas not monomorphic
runtimeRepPrimRep :: HasDebugCallStack => SDoc -> Type -> [PrimRep] #
Take a type of kind RuntimeRep and extract the list of PrimRep that
it encodes. See also Note [Getting from RuntimeRep to PrimRep]
The [PrimRep] is the final runtime representation after unarisation
typePrimRepArgs :: HasDebugCallStack => Type -> [PrimRep] #
A PrimRep is an abstraction of a type. It contains information that
the code generator needs in order to pass arguments, return results,
and store values of this type. See also Note [RuntimeRep and PrimRep] in
GHC.Types.RepType and Note [VoidRep] in GHC.Types.RepType.
Constructors
| VoidRep | |
| LiftedRep | |
| UnliftedRep | Unlifted pointer |
| Int8Rep | Signed, 8-bit value |
| Int16Rep | Signed, 16-bit value |
| Int32Rep | Signed, 32-bit value |
| Int64Rep | Signed, 64 bit value |
| IntRep | Signed, word-sized value |
| Word8Rep | Unsigned, 8 bit value |
| Word16Rep | Unsigned, 16 bit value |
| Word32Rep | Unsigned, 32 bit value |
| Word64Rep | Unsigned, 64 bit value |
| WordRep | Unsigned, word-sized value |
| AddrRep | A pointer, but not to a Haskell value (use '(Un)liftedRep') |
| FloatRep | |
| DoubleRep | |
| VecRep Int PrimElemRep | A vector |
Instances
| Data PrimRep # | |
Defined in GHC.Core.TyCon Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PrimRep -> c PrimRep Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PrimRep Source # toConstr :: PrimRep -> Constr Source # dataTypeOf :: PrimRep -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PrimRep) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PrimRep) Source # gmapT :: (forall b. Data b => b -> b) -> PrimRep -> PrimRep Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PrimRep -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PrimRep -> r Source # gmapQ :: (forall d. Data d => d -> u) -> PrimRep -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> PrimRep -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PrimRep -> m PrimRep Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PrimRep -> m PrimRep Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PrimRep -> m PrimRep Source # | |
| Show PrimRep # | |
| Binary PrimRep # | |
| Outputable PrimRep # | |
Defined in GHC.Core.TyCon | |
| Eq PrimRep # | |
| Ord PrimRep # | |
primRepToType :: PrimRep -> Type #
Convert a PrimRep back to a Type. Used only in the unariser to give types to fresh Ids. Really, only the type's representation matters. See also Note [RuntimeRep and PrimRep]
countFunRepArgs :: Arity -> Type -> RepArity #
countConRepArgs :: DataCon -> RepArity #
tyConPrimRep :: HasDebugCallStack => TyCon -> [PrimRep] #
Find the runtime representation of a TyCon. Defined here to
avoid module loops. Returns a list of the register shapes necessary.
See also Note [Getting from RuntimeRep to PrimRep]
tyConPrimRep1 :: HasDebugCallStack => TyCon -> PrimRep #
Like tyConPrimRep, but assumed that there is precisely zero or
one PrimRep output
See also Note [Getting from RuntimeRep to PrimRep] and Note [VoidRep]
Unboxed sum representation type
ubxSumRepType :: [[PrimRep]] -> [SlotTy] #
Given the arguments of a sum type constructor application, return the unboxed sum rep type.
E.g.
(# Int# | Maybe Int | (# Int#, Float# #) #)
We call `ubxSumRepType [ [IntRep], [LiftedRep], [IntRep, FloatRep] ]`, which returns [WordSlot, PtrSlot, WordSlot, FloatSlot]
INVARIANT: Result slots are sorted (via Ord SlotTy), except that at the head of the list we have the slot for the tag.
layoutUbxSum :: SortedSlotTys -> [SlotTy] -> [Int] #
typeSlotTy :: UnaryType -> Maybe SlotTy #
Constructors
| PtrLiftedSlot | |
| PtrUnliftedSlot | |
| WordSlot | |
| Word64Slot | |
| FloatSlot | |
| DoubleSlot | |
| VecSlot Int PrimElemRep |
Instances
| Outputable SlotTy # | |
Defined in GHC.Types.RepType | |
| Eq SlotTy # | |
| Ord SlotTy # | |
slotPrimRep :: SlotTy -> PrimRep #
primRepSlot :: PrimRep -> SlotTy #