Note [VoidRep]

GHC/Types/RepType.hs:434 compiler

PrimRep is used to denote one primitive representation.
Because of unboxed tuples and sums, the representation of a value
in general is a list of PrimReps. (See also Note [RuntimeRep and PrimRep].)

For example:
    typePrimRep Int#             = [IntRep]
    typePrimRep Int              = [LiftedRep]
    typePrimRep (# Int#, Int# #) = [IntRep,IntRep]
    typePrimRep (# #)            = []
    typePrimRep (State# s)       = []

After the unariser, all identifiers have at most one PrimRep
(that is, the [PrimRep] for each identifier is empty or a singleton list).
More precisely: typePrimRep1 will succeed (not crash) on every binder
and argument type.
(See Note [Post-unarisation invariants] in GHC.Stg.Unarise.)

Thus, we have

1. typePrimRep :: Type -> [PrimRep]
   which returns the list

2. typePrimRepU :: Type -> PrimRep
   which asserts that the type has exactly one PrimRep and returns it

3. typePrimRep1 :: Type -> PrimOrVoidRep
   data PrimOrVoidRep = VoidRep | NVRep PrimRep
   which asserts that the type either has exactly one PrimRep or is void.

Likewise, we have idPrimRepU and idPrimRep1, stgArgRepU and stgArgRep1,
which have analogous preconditions.

References 2

Referenced by 8