Closed hseg closed 4 years ago
STAN-0213 is not about pattern-matching failures. It is about maintainability issue, e.g. when you add a new constructor to data type, you won't automatically know what functions you need to update since GHC won't warn you if you use _
. In your case, if you add a new constructor to the R
type, your function can potentially become broken if you forget to handle other constructors.
In this particular situation, you should apply one of the following solutions to make your code more robust against future changes:
\case of
(R 0 t) -> ...
R{} -> ...
\case of
(R 0 t) -> ...
_don'tCare -> ...
Fair enough.
Consider
data R = R { f1 :: Int, f2 :: T2 }
. Clearly, a pattern match of formisn't going to fail. However,
STAN-0213
still fires.