All warnings but type signatures

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun May 13 10:39:39 EDT 2007


On Sun, 2007-05-13 at 14:23 +0100, Joel Reymont wrote:
> Is there a way to enable all warnings but the following:
> 
> Hope/Item/DBDesc.hs:6:0:
>      Warning: Definition but no type signature for `item_db'

See the users guide section on warnings:

http://haskell.org/ghc/docs/latest/html/users_guide/flag-reference.html#id3133584

Try turning on most (-W) or all (-Wall) warning and turning off the
warning for missing type signatures (-fno-warn-missing-signatures).

> Overall, is there an advantage to type signatures in GHC as opposed  
> to letting the compiler derive them?

Yes. It helps in thinking about the code. I often design by starting
with just type signatures and data type definitions. It also helps
enormously with finding the reasons for type errors. It also serves as
documentation for yourself and other readers of your code.

Constraining types of functions can often help performance too, for
example if you don't need some function to be overloaded for all numeric
types then you can constrain it to be Int for example.

Duncan



More information about the Glasgow-haskell-users mailing list