#2004: Pattern matching against GADTs without -XGADTs has odd behavior.
-------------------------------------+--------------------------------------
 Reporter:  guest                    |          Owner:  simonpj    
     Type:  bug                      |         Status:  new        
 Priority:  normal                   |      Milestone:  6.10 branch
Component:  Compiler (Type checker)  |        Version:  6.8.1      
 Severity:  normal                   |     Resolution:             
 Keywords:                           |     Difficulty:  Unknown    
 Testcase:                           |   Architecture:  Unknown    
       Os:  Unknown                  |  
-------------------------------------+--------------------------------------
Comment (by simonpj):

 Turns out that if `-XGADTs` was not set when pattern matching on a GADT,
 we simply ignored the equational constraints.  This is silly.

 I've changed it so that `-XGADTs` is consulted only when deciding whether
 to permit the ''definition'' of a GADT, not to permit its use.  This is
 consistent with (eg) overlapping instances.

 Here's the note from TcPat
 {{{
 Note [Flags and equational constraints]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 If there are equational constraints, we take account of them
 regardless of flag settings; -XGADTs etc applies only to the
 *definition* of a data type.

 An alternative would be also to reject a program that *used*
 constructors with equational constraints.  But want we should avoid at
 all costs is simply to *ignore* the constraints, since that gives
 incomprehensible errors (Trac #2004).
 }}}
 Probably worth merging into the 6.8 branch, but not a big deal:
 {{{
 Fri Jan  4 12:58:14 GMT 2008  [EMAIL PROTECTED]
   * Do not consult -XGADTs flag when pattern matching on GADTs
 }}}

 Simon

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

Reply via email to