#3078: Erroneous warnings for -XPatternGuards
-------------------+--------------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.10.1 | Severity: normal
Keywords: | Testcase:
Os: Linux | Architecture: x86_64 (amd64)
-------------------+--------------------------------------------------------
As nonstandard PatternGuards I get a meaningless warning:
{{{
walltest.hs:8:10:
Warning: Pattern match(es) are non-exhaustive
In the definition of `n': Patterns not matched:
Ok, modules loaded: Main.
}}}
{{{
{-# LANGUAGE PatternGuards #-}
{-# OPTIONS -Wall #-}
data T = A Int | B Int
funny :: T -> Int
funny t = n
where n | A x <- t = x
| B x <- t = x
}}}
But none of that happens when using a case expression for the same thing:
{{{
{-# OPTIONS -Wall #-}
data T = A Int | B Int
funny :: T -> Int
funny t = n
where n = case t of
(A x) -> x
(B x) -> x
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3078>
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