Re: ghc should be able to deduce correct use of partial functions and not give a warning in such cases

Henning Thielemann <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
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.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.