[GHC] #16289: GHC thinks pattern match is exhaustive

#16289: GHC thinks pattern match is exhaustive -------------------------------------+------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 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: -------------------------------------+------------------------------------- {{{ {-# OPTIONS_GHC -Werror #-} module Lib where data Value = Finite Integer | Infinity deriving (Eq) instance Num Value where (+) = undefined (*) = undefined abs = undefined signum = undefined negate = undefined fromInteger = Finite isSpecial :: Value -> Bool isSpecial Infinity = True isSpecial 0 = True isSpecial 1 = True isSpecial _ = False }}} {{{
ghc Lib.hs [1 of 1] Compiling Lib ( Lib.hs, Lib.o )
Lib.hs:19:1: error: [-Woverlapping-patterns, -Werror=overlapping-patterns] Pattern match is redundant In an equation for ‘isSpecial’: isSpecial 1 = ... | 19 | isSpecial 1 = True | ^^^^^^^^^^^^^^^^^^^^^^^^^ Lib.hs:20:1: error: [-Woverlapping-patterns, -Werror=overlapping-patterns] Pattern match is redundant In an equation for ‘isSpecial’: isSpecial _ = ... | 20 | isSpecial _ = False | ^^^^^^^^^^^^^^^^^^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16289 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16289: GHC thinks pattern match is exhaustive -------------------------------------+------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: 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 goldfire): * priority: normal => high Comment: That's pretty frightening. I'm bumping priority, but anyone can feel free to disagree with that judgment. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16289#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16289: GHC thinks pattern match is exhaustive -------------------------------------+------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 8.6.3 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/16289#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16289: GHC thinks pattern match is exhaustive -------------------------------------+------------------------------------- Reporter: dnspies | Owner: (none) Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 8.6.3 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: | -------------------------------------+------------------------------------- Comment (by harpocrates): This looks suspiciously like https://ghc.haskell.org/trac/ghc/ticket/15713 (that's about overloaded strings, but otherwise pretty much the same situation). There's something fishy about exhaustiveness checking on overloaded literals in general. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16289#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC