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

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Fri Jun 22 18:11:24 EDT 2007

On Jun 22, 2007, at 17:46 , David Roundy wrote:

> -Wall -Werror isn't a seat belt, it's a coding-style guideline.

So, as long as we're on this topic...

I have a program which I'm checking with -Wall but not -Werror,  
because it has several pattern matches which *I* know are fine but  
which ghc doesn't.  (I suspect, from its description, that Catch  
would also recognize it's fine.)  Which leads me to wonder:

(1) any way to flag a pattern match as "I know this is okay", don't  
warn about it" without shutting off pattern match warnings completely?

(2) any way that, given the need to roll a bunch of records into a  
single type, I can somehow declare things such that calling one of  
these functions that expects only a single component record type with  
a different record type raises a *compile-time* error?  (That is,  
roughly the opposite of the usual pattern match error behavior.)   
Unfortunately I can't split the records into independent types  
because the full record type controls a state machine and different  
states require different components, and I can't use a typeclass to  
do it because you can't declare a list of a typeclass (VRow r) =>  
[r].  (Yes, this may become an array later, but it's only 25 or so  

The special cases are where I'm asking the state machine to do  
lookups from "files" that are actually things like DNS lookups.  Some  
of these are passed file-based lookups in order to modify the DNS  
lookup's result (domain stripping, for example) and these will (a)  
never be invoked with a lookup type other than VDNS and (b) never be  
handed a VProcess-based VLookup or a VDNS as the modifier.

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list