[GHC] #2358: Template Haskell's TupleT considers unary tuples as a valid types.

View: New views
5 Messages — Rating Filter:   Alert me  

[GHC] #2358: Template Haskell's TupleT considers unary tuples as a valid types.

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2358: Template Haskell's TupleT considers unary tuples as a valid types.
------------------------+---------------------------------------------------
    Reporter:  fons     |       Owner:                  
        Type:  bug      |      Status:  new            
    Priority:  normal   |   Component:  Template Haskell
     Version:  6.8.2    |    Severity:  normal          
    Keywords:           |    Testcase:                  
Architecture:  Unknown  |          Os:  Unknown        
------------------------+---------------------------------------------------
 I don't know how tuples are internally implemented in GHC, but the Haskell
 report (3.8) specifically establishes two as their lower size bound.

 When provided a zero (or null list) arguments, all TupleT, TupP and TupE
 behave like the unit type (which is certainly reasonable). However, they
 handle argument 1 (or the singleton list) in different ways:

  * {{{TupleP [pat]}}} is equivalent to {{{pat}}} (which again, is
 perfectly reasonable)
  * {{{TupE [exp]}}} behaves as exp (again, it seems right)

 However:

  * {{{TupleT 1 `AppT` VarT ''Int}}} is a different type than {{{VarT
 ''Int}}}

 See the following two examples:

  1. {{{tupE [exp]}}} behaves as expected:

 {{{
 Prelude Language.Haskell.TH> $(sigE (tupE [[|1|]]) (conT ''Int))
 1
 }}}

  2. {{{tupleT 1}}} doesn't:

 {{{
 Prelude Language.Haskell.TH> $(sigE [|1|] (tupleT 1 `appT` conT ''Int))

 <interactive>:1:2:
     No instance for (Num (Int))
       arising from the literal `1' at <interactive>:1:2-40
     Possible fix: add an instance declaration for (Num (Int))
     In the expression: $(sigE [| 1 |] (tupleT 1 `appT` conT 'Int))
     In the definition of `it':
         it = $(sigE [| 1 |] (tupleT 1 `appT` conT 'Int))
 }}}

 Probably, since unary tuples are not legal, the typechecker should simply
 raise an error when {{{TupleT}}} is found to have received {{{1}}} as
 argument.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2358>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2358: Template Haskell's TupleT considers unary tuples as a valid types.

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2358: Template Haskell's TupleT considers unary tuples as a valid types.
------------------------------+---------------------------------------------
 Reporter:  fons              |          Owner:  igloo  
     Type:  merge             |         Status:  new    
 Priority:  normal            |      Milestone:        
Component:  Template Haskell  |        Version:  6.8.2  
 Severity:  normal            |     Resolution:        
 Keywords:                    |     Difficulty:  Unknown
 Testcase:  TH_1tuple         |   Architecture:  Unknown
       Os:  Unknown           |  
------------------------------+---------------------------------------------
Changes (by simonpj):

  * testcase:  => TH_1tuple
  * difficulty:  => Unknown
  * type:  bug => merge
  * owner:  => igloo

Comment:

 Fixed by
 {{{
 Sat Jun 14 13:39:39 BST 2008  simonpj@...
   * Fix Trac #2358: 1-tuples in Template Haskell
 }}}
 Queue for merging to the branch, in the event of 6.8.4

 Simon

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2358#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2358: Template Haskell's TupleT considers unary tuples as a valid types.

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2358: Template Haskell's TupleT considers unary tuples as a valid types.
------------------------------+---------------------------------------------
 Reporter:  fons              |          Owner:  igloo    
     Type:  merge             |         Status:  new      
 Priority:  normal            |      Milestone:  6.8 branch
Component:  Template Haskell  |        Version:  6.8.2    
 Severity:  normal            |     Resolution:            
 Keywords:                    |     Difficulty:  Unknown  
 Testcase:  TH_1tuple         |   Architecture:  Unknown  
       Os:  Unknown           |  
------------------------------+---------------------------------------------
Changes (by igloo):

  * milestone:  => 6.8 branch

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2358#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2358: Template Haskell's TupleT considers unary tuples as a valid types.

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2358: Template Haskell's TupleT considers unary tuples as a valid types.
------------------------------+---------------------------------------------
 Reporter:  fons              |          Owner:            
     Type:  merge             |         Status:  new      
 Priority:  normal            |      Milestone:  6.8 branch
Component:  Template Haskell  |        Version:  6.8.2    
 Severity:  normal            |     Resolution:            
 Keywords:                    |     Difficulty:  Unknown  
 Testcase:  TH_1tuple         |   Architecture:  Unknown  
       Os:  Unknown           |  
------------------------------+---------------------------------------------
Changes (by igloo):

  * owner:  igloo =>

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2358#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2358: Template Haskell's TupleT considers unary tuples as a valid types.

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2358: Template Haskell's TupleT considers unary tuples as a valid types.
------------------------------+---------------------------------------------
 Reporter:  fons              |          Owner:                  
     Type:  merge             |         Status:  closed          
 Priority:  normal            |      Milestone:  6.8 branch      
Component:  Template Haskell  |        Version:  6.8.2          
 Severity:  normal            |     Resolution:  fixed          
 Keywords:                    |     Difficulty:  Unknown        
 Testcase:  TH_1tuple         |   Architecture:  Unknown/Multiple
       Os:  Unknown/Multiple  |  
------------------------------+---------------------------------------------
Changes (by igloo):

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

Comment:

 We won't be releasing 6.8.4.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2358#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
LightInTheBox - Buy quality products at wholesale price