wording of compile-time warning/run-time error message for binding with "| False"
I saw #20024 (closed) is being worked on, and this here seems related. It is a fringe case though - adding a guard to the only binding for a name just makes the program non-total. Still, it may be useful for documenting and run-time-checking an invariant.
GHCi, version 9.1.20210315: https://www.haskell.org/ghc/ :? for help ghci> a | False = () <interactive>:1:5: warning: [-Woverlapping-patterns] Pattern match is redundant In an equation for ‘a’: a | False = ... ghci> a *** Exception: <interactive>:1:1-14: Non-exhaustive patterns in function a
The wording here feels a bit off (both messages)
- "redundant" is technically correct (the pattern match can be removed without changing the meaning of the program) but usually (and especially with "overlapping") it means "... because some other pattern already matched"
- "non-exhaustive" is fine (the present patterns cannot handle this)
- "function" is wrong? Yes, nullary function, but ...