[GHC] #5720: Unit unboxed tuple behaving oddly

GHC cvs-ghc at haskell.org
Fri Dec 23 13:47:43 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:                    |  
---------------------------------+------------------------------------------
 I’ve just discovered something very peculiar with unboxed tuples in GHC.
 {{{
         f2 x = (# True, False #)
         f1 x = (# True #)
         f0 x = (# #)
 }}}
 What types do these functions have?
 {{{
         f2 :: a -> (# Bool, Bool #)
         f1 :: a -> (# Bool #)
 BUT
         f0 :: a -> b -> (# b #)
 }}}
 I think this is stupid.  It should be
 {{{
         f0 :: a -> (# #)
 }}}
 But in fact even that type isn’t what you expect (ie the analogue of  `f
 :: a -> ()` )
 Here are the kinds of the type constructors:
 {{{
         (,,) :: * -> * -> * -> *
         (,) :: * -> * -> *
         () :: *

         (# ,, #) :: * -> * -> * -> #
         (# , #) :: *  -> * -> #
 BUT
         (#  #) :: * -> #
 }}}
 In both respects unboxed unit tuples are behaving differently to boxed
 ones. This seems bonkers.  I propose to fix this, but I wanted to check if
 anyone is relying on the current odd behaviour.


 Simon

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



More information about the Glasgow-haskell-bugs mailing list