[GHC] #366: incomplete patterns and GADT

GHC trac at galois.com
Wed Jul 22 06:56:48 EDT 2009


#366: incomplete patterns and GADT
----------------------------------------------------------+-----------------
    Reporter:  nobody                                     |        Owner:                  
        Type:  feature request                            |       Status:  closed          
    Priority:  normal                                     |    Milestone:  _|_             
   Component:  Compiler                                   |      Version:  None            
    Severity:  minor                                      |   Resolution:  fixed           
    Keywords:                                             |   Difficulty:  Unknown         
    Testcase:  tc215, deSugar/should_compile/GadtOverlap  |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple                           |  
----------------------------------------------------------+-----------------
Changes (by simonpj):

  * testcase:  tc215 => tc215, deSugar/should_compile/GadtOverlap
  * status:  new => closed
  * resolution:  None => fixed

Comment:

 I have not done the full overhaul envisaged by #595, but it turned out to
 be rather easy to make GADTs play nicely with overlapping-pattern
 warnings.
 {{{
    * Take account of GADTs when reporting patterm-match overlap
    Ignore-this: 7dcbdcb91021e83e6e6208a2e68c50c9
    When matching against a GADT, some of the constructors may be
 impossible.
     For example
         data T a where
              T1 :: T Int
              T2 :: T Bool
              T3 :: T a
         f :: T Int ->  Int
         f T1 = 3
         f T3 = 4

    Here, does not have any missing cases, despite omittting T2, because
    T2 :: T Bool.

    This patch teaches the overlap checker about GADTs, which happily
    turned out to be rather easy even though the overlap checker needs
    a serious rewrite.
 }}}
 Simon

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


More information about the Glasgow-haskell-bugs mailing list