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

David Roundy droundy at darcs.net
Sat Jun 23 17:55:11 EDT 2007


On Fri, Jun 22, 2007 at 03:14:06PM -0700, Stefan O'Rear wrote:
> On Fri, Jun 22, 2007 at 06:11:24PM -0400, Brandon S. Allbery KF8NH wrote:
> > (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?
> 
> 
> case scrutinee of
>   Pattern -> alternative
>   Pattern -> alternative
>   _ -> error "Can't happen in functionname"

darcs has an "impossible" C-preprocessor macro that we use for this, which
uses __FILE__ and __LINE__ to automatically give a useful (to developers)
error message if it turns out that the case was possible after all.
-- 
David Roundy
http://www.darcs.net


More information about the Haskell-Cafe mailing list