[Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

David Roundy droundy at darcs.net
Fri Jun 22 19:37:58 EDT 2007

On Fri, Jun 22, 2007 at 03:07:59PM -0700, Dave Bayer wrote:
> On Jun 22, 2007, at 2:46 PM, David Roundy wrote:
> >I think of top-level type declarations as type-checked comments, rather
> >than a seat-belt.  It forces you to communicate to others what a
> >function does, if that function may be used elsewhere.  I like this.
> >Although it can be cumbersome for quick and dirty code, developers
> >trying to read your code will thank you for it (unless you make
> >*everything* top-level, which is just poor coding style).
> >
> >-Wall -Werror isn't a seat belt, it's a coding-style guideline.
> I don't think one can make blanket statements as to what type systems  
> "are for". I doubt that the people who've dedicated their lives to  
> type theory are doing so to provide style guidelines.

-Wall doesn't flag type errors, and really has little to do with type
systems.  It's a set of heuristics describing for what someone considers
poor programming practices.

I agree that type systems are much more than that, that wasn't what (I
thought) we were talking about.  You get strongly-typed code whether or not
you enable warnings.

And regarding my above statement about top-level type declarations, that's
about the declarations, not the type system.  They have no effect on the
code that's generated (except in occasional rare cases, where they allow
the compiler to do more optimizations), but they do allow you to get better
error messages, and they communicate your intent to code readers.  I see
the latter as the better reason to always include top-level type
David Roundy
Department of Physics
Oregon State University

More information about the Haskell-Cafe mailing list