[Haskell-cafe] coding standard question

Erik de Castro Lopo mle+hs at mega-nerd.com
Mon Jun 22 01:11:18 EDT 2009


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.

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the Haskell-Cafe mailing list