[Haskell-cafe] coding standard question

Henning Thielemann lemming at henning-thielemann.de
Mon Jun 22 17:26:12 EDT 2009


On Mon, 22 Jun 2009, Malcolm Wallace wrote:

> Example:
>
>  f a b = g (a+b) (b-a)
>        where g a c = a*c
>
> ghc warns that g's parameter a shadows the parameter to f.  So we
> introduce a primed identifier to eliminate the warning:
>
>  f a b = g (a+b) (b-a)
>        where g a' c = a*c
>
> Now, no warnings!  But, oops, this function does not do the same thing.
> We forgot to add a prime to all occurrences of a on the right-hand-side.

Actually there will be the warning, that a' is unused.


More information about the Haskell-Cafe mailing list