[Haskell-cafe] coding standard question

Neil Brown nccb2 at kent.ac.uk
Mon Jun 22 06:26:17 EDT 2009


Jules Bean wrote:
> I've been using GHC for years and my honest opinion is that the 
> warnings very rarely flag an actual maintainability problem in the 
> code I write, and very frequently annoying highlight something I knew 
> I was doing, and did quite deliberately - most often inexhaustive 
> patterns or shadowing.
I would agree to a certain extent about the warnings.  Name shadowing is 
not really a problem, and it's often hard to avoid shadowing names that 
already exist in an imported module (why shouldn't I have a variable 
named lines?).  It's also usually the case that when I write 
inexhaustive pattern matches, it's because I know that the function (in 
a where clause) cannot be called with the missing pattern.  Type 
defaulting and monomorphism bits may be useful to some, but I only 
usually fix them to get rid of the warning, not because they cause a 
problem.

The ones I find useful are unused imports (handy for tidying up the 
import list), overlapping patterns, missing fields, warnings about tabs 
and a few others.

Of course, you can easily customise which warnings are on and which are 
off, so we can all have different preferences.  It would be nice to be 
able to set some warnings to be errors though, while leaving others as 
warnings, or turned off (don't think GHC can do this?).

Neil.


More information about the Haskell-Cafe mailing list