[GHC] #1806: panic when pattern matching infix constructors with too many arguments

GHC trac at galois.com
Mon Oct 29 05:12:18 EDT 2007


#1806: panic when pattern matching infix constructors with too many arguments
------------------------------------------------+---------------------------
    Reporter:  guest                            |        Owner:         
        Type:  bug                              |       Status:  new    
    Priority:  normal                           |    Milestone:         
   Component:  Compiler                         |      Version:  6.8    
    Severity:  minor                            |   Resolution:         
    Keywords:  panic infix constructor pattern  |   Difficulty:  Unknown
          Os:  Unknown                          |     Testcase:         
Architecture:  Unknown                          |  
------------------------------------------------+---------------------------
Comment (by simonpj):

 Interesting case. I rather think that it should be illegal to declare an
 infix constructor with other than 2 arguments.
   * If there are fewer than 2, as in your example, you can only use it
 prefix (in both expressions and patterns).
   * If there are more than 2, you can perhaps use it infix, but it's jolly
 confusing:
 {{{
   data T = (:*) Int Int Int

   f :: T -> T
   f ((x :* y) z) = (z :* x) y
 }}}
 Still, H98 doesn't actually prohibit infix constructors with non-2
 arguments, so I suppose I'd better fix GHC to complain more gracefully
 when it meets the pattern.

 Simon

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


More information about the Glasgow-haskell-bugs mailing list