[Haskell-cafe] coding standard question

Magnus Therning magnus at therning.org
Mon Jun 22 01:35:34 EDT 2009

Erik de Castro Lopo wrote:
> Vasili I. Galchin wrote:
>>      I am working with some existing code. "where/let" functions use the
>> same name for function parameters as the outer function and hence there is a
>> "shadow" warning from the compiler. To me it doesn't see totally
>> unreasonable to code like this .... the downside is the nasty ghc warnings.
>> Is there a coding consensus on this issue?
> I'm relatively new to Haskell, but I know that in imperative
> languages like C, a small percentage of "shadow" warnings are
> often real bugs and hence always worth fixing if possible 
> (sometimes the problem is in system header files and hence 
> can't be fixed).
> In Haskell there is an easy way around this. Variables can
> be name a, a', a'' and so on. Since these aid in clarity
> without forcing you to think up new variable names, I would
> suggest that its a good idea to fix these warnings.

Speaking from experience it's good to fix all warnings, since otherwise there 
will be enough of them to cause a few "terminal pages" to scroll by when you 
compile and then there's a real danger of not noticing real errors.  I'd pass 
'-Wall -Werror' to ghc to force myself to do this :-)

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.


Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090622/07c7d7db/signature.bin

More information about the Haskell-Cafe mailing list