GHC thinks pattern match is exhaustive
{-# 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
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |