[Haskell-cafe] coding standard question

Jochem Berndsen jochem at functor.nl
Mon Jun 22 09:45:08 EDT 2009


Jules Bean wrote:
> Magnus Therning wrote:
>> Also from experience, I get a good feeling about software that
>> compiles without warnings.  It suggests the author cares and is
>> indicative of some level of quality.
> 
> In contrast, I find almost all the GHC warnings to be useless, and
> therefore turn them off. I don't find they have a significant
> correlation with code quality.
> 
> YMMV :)

I strongly disagree with this.
There is a huge difference between

f (x:xs) = ...

and

f (x:xs) = ...
f [] = error "f: we expect a nonempty list"

The reason for this is that in the second case you express to somebody
who reads your code (including yourself) that this omission was intentional.

The same holds for other warnings (although I sometimes am annoyed by
the shadowing warnings, I agree :).

My default is to start developing, then adding -Wall -Werror and make it
compile again.

Regards,

-- 
Jochem Berndsen | jochem at functor.nl
GPG: 0xE6FABFAB


More information about the Haskell-Cafe mailing list