[GHC] #5813: Offer a compiler warning for failable pattern matches

GHC cvs-ghc at haskell.org
Fri Feb 3 14:58:31 CET 2012


#5813: Offer a compiler warning for failable pattern matches
---------------------------------+------------------------------------------
    Reporter:  snoyberg          |       Owner:                  
        Type:  feature request   |      Status:  new             
    Priority:  normal            |   Milestone:  7.6.1           
   Component:  Compiler          |     Version:  7.2.2           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by igloo):

  * difficulty:  => Unknown
  * milestone:  => 7.6.1


Comment:

 I'd be inclined to close this as wontfix, as John explains in http://www
 .mail-archive.com/haskell-cafe at haskell.org/msg96527.html :
 {{{

 This is actually the right useful behavior. using things like

 do
    Just x <- xs
    Just y <- ys
    return (x,y)

 will do the right thing, failing if xs or ysresults in Nothing. for
 instance, in the list monad, it will create the cross product of the
 non Nothing members of the two lists. a parse monad may backtrack and
 try another route, the IO monad will create a useful (and
 deterministic/catchable) exception pointing to the exact file and line
 number of the pattern match. The do notation is the only place in
 haskell that allows us to hook into the pattern matching mechanism of
 the language in a general way.
 }}}

 What do other people think?

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



More information about the Glasgow-haskell-bugs mailing list