Skip to content

unboxedSum{Type,Data}Name: Use GHC.Types as the module

Ryan Scott requested to merge wip/T24750 into master

Unboxed sum constructors are now defined in the GHC.Types module, so if you manually quote an unboxed sum (e.g., ''Sum2#), you will get a Name like:

GHC.Types.Sum2#

The unboxedSumTypeName function in template-haskell, however, mistakenly believes that unboxed sum constructors are defined in GHC.Prim, so unboxedSumTypeName 2 would return an entirely different Name:

GHC.Prim.(#|#)

This is a problem for Template Haskell users, as it means that they can't be sure which Name is the correct one. (Similarly for unboxedSumDataName.)

This patch fixes the implementations of unboxedSum{Type,Data}Name to use GHC.Types as the module. For consistency with unboxedTupleTypeName, the unboxedSumTypeName function now uses the non-punned syntax for unboxed sums (Sum<N>#) as the OccName.

Fixes #24750 (closed).

Merge request reports