<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 2018-07-09 12:54 PM, Olga Ershova wrote:<br>
<blockquote type="cite"
cite="mid:CALujEfh8sFz72nmTJkvcDjqt4kdq5oPUg-2yWspcUY2pvmA5Ew@mail.gmail.com">
<div dir="ltr">In hindsight, maybe non-exhaustive case expression
should be errors, not warnings. But then adding new constructor
to the type could break existing code in multiple places, even
if constructor is never used. Not everybody ready to pay this
price.<br>
</div>
</blockquote>
<br>
You make a good point, and this is the best explanation I've seen in
this discussion. However, even if the constructor is never used in
your own code, it may well be used in library code that you call. I
think it's dangerous for for the programmer not to know when a new
constructor is added. I prefer to have this warning enabled, and my
policy is to use -Wall -Werror from the start of any new project. I
then turn off specific warnings (eg orphans) with a pragma in
individual source files when I really need to use something.<br>
<br>
I was interested to see that GHC allows you to turn any warning into
an error, so I assume Haskell could be made total for pattern
matching with:<br>
<br>
-Werror=incomplete-patterns<br>
</body>
</html>