[Haskell-cafe] Avoiding "Non-exhaustive patterns in function f"
lemming at henning-thielemann.de
Wed Jun 20 06:26:05 EDT 2007
On Tue, 19 Jun 2007, Stefan O'Rear wrote:
> Like all good UNIX compilers, GHC will only print warnings if you ask it
> to, with -Wincomplete-patterns (iirc). -Wall enables most of them, the
> full list is in The Glorious Glasgow Haskell Compilation System User's
> Guide (a valuable read!)
Since GHC is not a C compiler (philosophy: "the programmers knows what he
does") but a Haskell compiler (philosophy: "assist the programmer on
finding mistakes") the warnings should be on by default, to encourage good
programming style and find mistakes early. "Non-exhaustive patterns" often
indicates possible situations for crashes. "unused identifier" often
indicates that one has not completed the implementation of a function.
Unfortunately GHC-6.4 warns about unnecessarily imported modules, but when
you remove the import statement, some identifiers are missing.
More information about the Haskell-Cafe