#5762: GHC gives incorrect warnings with simple applications of the view patterns extension -----------------------------------------------+---------------------------- Reporter: jmg | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.3 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Incorrect warning at compile-time | Testcase: Blockedby: | Blocking: Related: | -----------------------------------------------+---------------------------- GHC is not able to infer exhaustivity of f1 in the following example {{{ {-# LANGUAGE ViewPatterns #-} {-# OPTIONS_GHC -fwarn-incomplete-patterns #-} module VP where
f1, f2 :: Either Int Int -> Either Int Int f1 (id -> Left _ ) = undefined f1 (id -> Right _ ) = undefined f2 (Left _ ) = undefined f2 (Right _ ) = undefined f (id -> _) = undefined }}} GHC outputs: {{{ [1 of 1] Compiling VP ( VP.hs, interpreted ) VP.hs:8:1: Warning: Pattern match(es) are non-exhaustive In an equation for `f1': Patterns not matched: _ Ok, modules loaded: VP. }}} I've tested this with GHC 7.0.4, 7.2.2, and 7.4.1-rc1 on Mac OS X. BTW: There is neither a version entry for 7.2.2 nor for 7.4.1-rc1 in Trac. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5762> 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