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

Derek Elkins derek.a.elkins at gmail.com
Fri Jun 22 18:37:45 EDT 2007

On Sat, 2007-06-23 at 00:29 +0200, Henning Thielemann wrote:
> On Fri, 22 Jun 2007, Brandon S. Allbery KF8NH wrote:
> > 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?
> Add the "catch all" case with '_':
> f _ = error "this case cannot occur, because this would violate the invariant X"
> If the error occurs anyway, you get a report that your believe was wrong.
> (Or the user gets the report, and he doesn't know how to react.)

Sure he does.  Irately tell you that your program doesn't work and then,
upon repeated prompting and guidance, provide you with said error

More information about the Haskell-Cafe mailing list