Skip to content

Deprecate `PrimTyConI`

See also

Motivation

One of the possible response forms from reifying a datatype using template-haskell is the PrimTyConI constructor. This is defined as:

data Info =
...
  -- | A \"primitive\" type constructor, which can't be expressed with a 'Dec'.
  -- Examples: @(->)@, @Int#@.
  | PrimTyConI
       Name
       Arity
       Unlifted
...

The strange thing about this constructor is that it could be completely subsumed into the TyConI case, which is the more general one for type constructors.

The only thing that sets it apart is that it labels the type as "primitive" (which I take to be wired-in unlifted/unboxed types). Yet, not all primitive types are represented by this constructor. Reifying unboxed tuples and sums gives you a TyConI constructor. So, it doesn't even give users an accurate portrait of which types are "primitive".

I think this used to be necessary before GHC had proper support for unboxed/unlifted kinds, but I'm not sure if it's still needed. It just appears to be a vestigial edge case.

Proposal

Stop emitting instances of this constructor and consistently use TyConI instead.

I don't think there's any immediate need to get rid of the constructor for now, since code might rely on its existence.

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