[GHC] #5720: Unit unboxed tuple behaving oddly

GHC cvs-ghc at haskell.org
Fri Dec 23 17:01:24 CET 2011


#5720: Unit unboxed tuple behaving oddly
---------------------------------+------------------------------------------
    Reporter:  simonpj           |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  normal            |   Milestone:                  
   Component:  Compiler          |     Version:  7.2.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by simonpj):

 Here's another way to look at it. For data constructors the current
 situation is this:
 {{{
 Arguments   Boxed      Unboxed
 3           ( , , )    (# , , #)
 2           ( , )      (# , #)
 1                      (# #)
 0           ()
 }}}
 Wierd!  Not only is it non-uniform, but there is no way to write a
 function that returns an empty unboxed tuple.

 I propose to change to this:
 {{{
 Arguments   Boxed      Unboxed
 3           ( , , )    (# , , #)
 2           ( , )      (# , #)
 1
 0           ()         (# #)
 }}}
 More uniform!  And you can return an empty unboxed tuple just fine.  If
 you the singleton-unboxed-tuple data constructor in source code, as a
 function, you'd write `(\x -> (# x #))`.   In a pattern, or applied, you'd
 write `(# x #)`.  Actually I can't think of a case when you want to treat
 a singleton unboxed tuple as a data constructor.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5720#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list