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

Dave Bayer bayer at cpw.math.columbia.edu
Fri Jun 22 15:34:09 EDT 2007

On Jun 22, 2007, at 11:42 AM, David Roundy wrote:

> On Fri, Jun 22, 2007 at 11:37:15AM -0700, Dave Bayer wrote:
>> GHC issues a "Warning: Defaulting the following constraint(s) to type
>> `Int'" for the definition of z.
> Why don't you just use -fno-warn-type-defaults?
> ghc -Werr -Wall is a often good idea, but if you prefer a different
> programming style (e.g. no top-level type declarations required),  
> ghc gives
> you the flexibility to do that.

To be precise, I __PREFER__ a "ghc  -Wall -Werror" programming style.  
In particular, I always want defaulting errors, because sometimes I  
miss the fact that numbers I can count on my fingers are defaulting  
to Integer.

Once I explicitly declare "default (Int)", I want "ghc  -Wall - 
Werror" to shut up, unless this defaulting rule never gets used.  
Instead, it complains anyways when the defaulting takes place that  
I've just declared I know about. In other words, I want warnings  
involving "default" to follow the same logic currently used for  
warnings involving "import".

This is a bug. I want "ghc  -Wall -Werror" to be a practical choice,  
left on all the time, and in my example I had to work too hard to  
avoid the warning. Other people just wouldn't use "ghc  -Wall - 
Werror", the way some people won't use seat belts, and the way some  
people view any strongly typed language as a cumbersome seat belt. If  
we tolerate ridiculously arcane syntax to handle these situations, we  
fully deserve to be marginalized while Ruby takes over the world.

In other words, I'm disputing that the top-level declarations are in  
fact required. GHC can be trivially modified to allow Haskell to  
handle this situation far more elegantly.

(It is amusing the sides we're taking on this, and the stereotype  
that physicists compute faster than mathematicians because they don't  
worry about convergence issues. Effectively, the stereotype holds  
that mathematicians think with "-Wall -Werror" on, and physicists  
don't. Perhaps it's true?)

More information about the Haskell-Cafe mailing list