logo       

Re: [GHC] #366: incomplete patterns and GADT: msg#00171

lang.haskell.glasgow.bugs

Subject: Re: [GHC] #366: incomplete patterns and GADT

#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_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise