Skip to content

Unary Unboxed Tuple Type Constructor

The type constructor for a unary unboxed tuple cannot be written in GHC haskell. Consider the following value which is wrapped in by a unary unboxed tuple:

>>> :type (# 5# #)
(# 5# #) :: (# Int# #)

Now consider the type constructor for unboxed 2-tuples:

>>> :set -fprint-explicit-kinds
>>> :set -fprint-explicit-foralls
>>> :kind! (# , #)
(# , #) :: forall (k0 :: RuntimeRep) (k1 :: RuntimeRep).
           TYPE k0
           -> TYPE k1
           -> TYPE
                ('TupleRep
                   ((':) RuntimeRep k0 ((':) RuntimeRep k1 ('[] RuntimeRep))))
= (#,#)

Horrid looking, but undoubtedly correct. But how can we do this for a unary unboxed tuple? The naive approach gives us the nullary tuple instead:

>>> :kind! (# #)
(# #) :: TYPE ('TupleRep ('[] RuntimeRep))
= (# #)

I do actually have a real use-case for this that I can discuss more if needed. For the syntax, I really haven't the faintest idea what I would expect. Maybe something like: (## ##) or (# @1 #), but those both seem pretty bad.

Trac metadata
Trac field Value
Version 8.4.1-alpha1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information