[Haskell-cafe] ghc should be able to deduce correct use of partial functions and not give a warning in such cases
Henning Thielemann
lemming at henning-thielemann.de
Tue Apr 16 15:45:21 UTC 2024
On Tue, 16 Apr 2024, George Colpitts wrote:
> Yes, that's basically how I fixed it but I really don't want to have to
> do that since the code is correct. Not a big deal but may be irritating
> to beginners or large projects that want to eliminate warnings. Do you
> think an ER would be rejected ? If I remember correctly there is already
> detection of incomplete pattern matching that is ok and in such cases
> warnings are omitted. This would be similar to that.
To my human linter 'tail' looks always suspicious and needs an additional
mental check, that 'tail' is no problem in your special case. The pattern
match does not have this problem. It both improves readability and
convinces GHC easily. That's what the warning shall achieve and it is even
a good guide to beginners.
More information about the Haskell-Cafe
mailing list