[GHC] #366: incomplete patterns and GADT

GHC trac at galois.com
Fri Oct 20 08:26:17 EDT 2006


#366: incomplete patterns and GADT
-----------------------------+----------------------------------------------
 Reporter:  nobody           |          Owner:  nobody  
     Type:  feature request  |         Status:  assigned
 Priority:  normal           |      Milestone:  6.8     
Component:  None             |        Version:  None    
 Severity:  minor            |     Resolution:  None    
 Keywords:                   |     Difficulty:  Unknown 
 Testcase:  tc215            |   Architecture:  Unknown 
       Os:  Unknown          |  
-----------------------------+----------------------------------------------
Changes (by igloo):

  * architecture:  => Unknown
  * difficulty:  => Unknown
  * milestone:  => 6.8
  * testcase:  => tc215
  * os:  => Unknown

Old description:

> {{{
> I would like to compile with
> -fwarn-incomplete-patterns and use GADTs,
> but I have bogus error messages.
> Suppose I define :
>
> data T a where
>     C1 :: T Char
>     C2 :: T Float
>
> then a function :
>
> exhaustive :: T Char -> Char
> exhaustive C1 = ' '
>
> If I compile with incomplete pattern warnings,
> I get that my function "exhaustive" is not
> exhaustive.
> But if I add a case :
>
> exhaust C2 = ' '
>
> then the compiler accurately warns me that this
> case is inaccessible.
> Would it be possible to add the accessibility check
> when compiling with incomplete patterns detection ?
> }}}

New description:

 {{{
 I would like to compile with
 -fwarn-incomplete-patterns and use GADTs,
 but I have bogus error messages.
 Suppose I define :

 data T a where
     C1 :: T Char
     C2 :: T Float

 then a function :

 exhaustive :: T Char -> Char
 exhaustive C1 = ' '

 If I compile with incomplete pattern warnings,
 I get that my function "exhaustive" is not
 exhaustive.
 But if I add a case :

 exhaust C2 = ' '

 then the compiler accurately warns me that this
 case is inaccessible.
 Would it be possible to add the accessibility check
 when compiling with incomplete patterns detection ?
 }}}

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


More information about the Glasgow-haskell-bugs mailing list