Skip to content

Clarify situation surrounding GHC.Exts and friends

Currently there are three modules provided by ghc-prim which export GHC's primitive types and operations:

  • GHC.Prim is deeply magical and provides primops and several primitive types
  • GHC.Types defines other not-quite-so-primitive types
  • GHC.Exts is supposed to be the user-facing interface for everything exported above

However, currently the status and stability of these modules is quite unclear to users. Moreover, historically not everything available in GHC.Types has been available via GHC.Exts (see #20695 (closed)).

We should clearly state that GHC.Prim and GHC.Types are not to be used directly by users and that they should rather use GHC.Exts.

Moveover, currently using GHC.Exts is unnecessarily difficult due to the immensity of its interface. I think we should rather split it up into several smaller modules. For instance:

  • GHC.Exts.SIMD exports the vector types and operations
  • GHC.Exts.Array exports the array types and operations
  • GHC.Exts.Int exports integer/word operations
  • GHC.Exts.Ptr exports the raw pointer operations

Finally, GHC.Exts would simply export all of these modules. We would then want a check to ensure that everything provided by GHC.Prim and GHC.Types is exported from GHC.Exts.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information