[Haskell-beginners] Warnings from ghc

Daniel Fischer daniel.is.fischer at googlemail.com
Sun Apr 3 17:59:28 CEST 2011


On Sunday 03 April 2011 17:24:52, Manfred Lotz wrote:
> Hi there,
> From my experiences in programming it is usually a good thing when
> a compiler issues warnings because this shows me where in my code there
> might be future problems hidden.
> 
> 
> I found the following warnings especially important to be turned on:
> 
> -fwarn-incomplete-patterns
> -fwarn-overlapping-patterns
> -fwarn-name-shadowing
> -fwarn-unused-matches

> -fwarn-unused-do-bind

I find that one rather annoying most of the time.
It's good if you write stuff like

do foo
   mapM bar baz
   quux

but it's just superfluous in situations like

do foo
   printf format some vars
   bar
   baz

which I have much more frequently (I don't remember ever having typo'ed 
mapM when I meant mapM_ or similar, doesn't mean it never happened, but 
it's rare - for me, at least)

> 
> I see that I could turn on all warnings with -Wall but that is a bit too
> much.

I tend to use
-Wall -fwarn-tabs -fno-warn-unused-do-bind -fno-warn-type-defaults
(unless I want to be warned on type-defaulting or unused do-binds, of 
course).
Switch on everything and explicitly switch off what you consider okay in 
that module.

> 
> 
> My question: what other options do people recommend to be turned on.

-fwarn-tabs
-fwarn-missing-signatures
-fwarn-orphans



More information about the Beginners mailing list