[GHC] #15884: Completeness of View Patterns With a Complete Set of Output Patterns

#15884: Completeness of View Patterns With a Complete Set of Output Patterns -------------------------------------+------------------------------------- Reporter: Shayan-Najd | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- For example, the code {{{#!hs {-# OPTIONS_GHC -Wall #-} {-# LANGUAGE ViewPatterns #-} f :: Maybe a -> Bool f (id->Nothing) = False f (id->(Just _)) = True }}} mistakenly returns the warning {{{ warning: [-Wincomplete-patterns] Pattern match(es) are non-exhaustive In an equation for âfâ: Patterns not matched: _ | 4 | f (id->Nothing) = False | ^^^^^^^^^^^^^^^^^^^^^^^^... }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15884 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15884: Completeness of View Patterns With a Complete Set of Output Patterns -------------------------------------+------------------------------------- Reporter: Shayan-Najd | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: | PatternMatchWarnings Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => PatternMatchWarnings -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15884#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15884: Completeness of View Patterns With a Complete Set of Output Patterns -------------------------------------+------------------------------------- Reporter: Shayan-Najd | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: duplicate | Keywords: | PatternMatchWarnings Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #15753 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => duplicate * related: => #15753 Comment: This is a duplicate of #15753 (see https://ghc.haskell.org/trac/ghc/ticket/15753#comment:3), so closing. In particular, note that this bug has nothing to do with `ViewPatterns`, as you can achieve the same erroneous warning with just ordinary `PatternGuards`: {{{#!hs {-# OPTIONS_GHC -Wall #-} module Bug where f :: Maybe a -> Bool f x | Nothing <- id x = False | Just _ <- id x = True }}} {{{ $ /opt/ghc/8.6.2/bin/ghci Bug.hs GHCi, version 8.6.2: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/ryanglscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:5:2: warning: [-Wincomplete-patterns] Pattern match(es) are non-exhaustive In an equation for âfâ: Patterns not matched: _ | 5 | f x | ^^^... }}} Removing the use of the `id` function, however, makes the warnings go away. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15884#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC