It is considered good practice to enable GHC warnings with -Wall
. However, I\'ve found out that fixing those warnings has a negative effect for some types of code c
Name shadowing can be quite dangerous. In particular, it can become difficult to reason about what scope a name is introduced in.
Unused pattern binds in do notation are not as bad, but can indicate that a less efficient function than necessary is being used (e.g. mapM
instead of mapM_
).
As BenMos pointed out, using void
or ignore
to explicitly discard unused values is a nice way to be explicit about things.
It would be quite nice to be able to disable warnings for just a section of code, rather than for everything at once. Also, cabal flags and command line ghc flags take precedence over flags in a file, so I can't have -Wall by default everywhere and even easily just disable it for the entirety of a single file.