#7156: "Pattern match on GADT" error for non-GADT
------------------------------+---------------------------------------------
 Reporter:  ryani             |          Owner:                                 
               
     Type:  bug               |         Status:  new                            
               
 Priority:  normal            |      Component:  Compiler (Type checker)        
               
  Version:  7.0.4             |       Keywords:  GADTs, TypeFamilies, 
ExistentialQuantification
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple               
               
  Failure:  None/Unknown      |       Testcase:                                 
               
Blockedby:                    |       Blocking:                                 
               
  Related:                    |  
------------------------------+---------------------------------------------
 It's widely known that GADTs are just generalizations of type equality and
 existentials.  And you can declare them that way!

 {{{
 {-# LANGUAGE TypeFamilies, ExistentialQuantification #-}
 module NonGADT where
 data T a = (a ~ ()) -> T
 }}}

 But pattern matching on this gives a nasty error!

 {{{
 f :: T a -> a
 f T = ()
 }}}

 {{{
 {-
 NonGADT.hs:7:3:
     A pattern match on a GADT requires -XGADTs
     In the pattern: T
     In an equation for `f': f T = ()
  -}
 }}}

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

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to