[GHC] #16289: GHC thinks pattern match is exhaustive
GHC
ghc-devs at haskell.org
Tue Feb 5 22:13:35 UTC 2019
#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
More information about the ghc-tickets
mailing list