[GHC] #5409: Language.Haskell.TH.Syntax.tupleDataName wrong for unit

GHC cvs-ghc at haskell.org
Wed Aug 17 09:01:57 CEST 2011


#5409: Language.Haskell.TH.Syntax.tupleDataName wrong for unit
------------------------------------------+---------------------------------
  Reporter:  NeilMitchell                 |          Owner:                  
      Type:  bug                          |         Status:  closed          
  Priority:  normal                       |      Milestone:                  
 Component:  Template Haskell             |        Version:  7.1             
Resolution:  fixed                        |       Keywords:                  
  Testcase:                               |      Blockedby:                  
Difficulty:                               |             Os:  Unknown/Multiple
  Blocking:                               |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  |  
------------------------------------------+---------------------------------
Changes (by simonpj):

  * status:  new => closed
  * resolution:  => fixed


Comment:

 Good point.  Fixed by
 {{{
 commit 0923cdc6ba600e67987f88c67ca80bf2d7a05400
 Author: Simon Peyton Jones <simonpj at microsoft.com>
 Date:   Wed Aug 17 07:58:36 2011 +0100

     The unit tuple is defined in a different module to other tuples
 (oddly)

     Fixes Trac #5409

 >---------------------------------------------------------------

  Language/Haskell/TH/Syntax.hs |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)

 diff --git a/Language/Haskell/TH/Syntax.hs b/Language/Haskell/TH/Syntax.hs
 index 18f6029..31e1300 100644
 --- a/Language/Haskell/TH/Syntax.hs
 +++ b/Language/Haskell/TH/Syntax.hs
 @@ -582,8 +582,9 @@ mk_tup_name n_commas space
    = Name occ (NameG space (mkPkgName "ghc-prim") tup_mod)
    where
      occ = mkOccName ('(' : replicate n_commas ',' ++ ")")
 -    -- XXX Should it be GHC.Unit for 0 commas?
 -    tup_mod = mkModName "GHC.Tuple"
 +    tup_mod | n_commas ==0 = mkModName "GHC.Unit"
 +            | otherwise    = mkModName "GHC.Tuple"
 +    -- Oddly () is in a different module than the other tuples
 }}}
 I don't understand why () is in a different module though!

 Simon

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



More information about the Glasgow-haskell-bugs mailing list