[GHC] #14673: Unary Unboxed Tuple Type Constructor

GHC ghc-devs at haskell.org
Tue Jan 16 01:27:30 UTC 2018


#14673: Unary Unboxed Tuple Type Constructor
-------------------------------------+-------------------------------------
           Reporter:  andrewthad     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.4.1-alpha1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14673>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list