Search code examples
haskellpattern-matchingnon-exhaustive-patterns

Haskell, Non-exhaustive patterns in function - way for checking this condition


Is there exist any way to check if my code contains: Non-exhaustive patterns in function ? Maybe some flag for compiler ?


Solution

  • Yes: -fwarn-incomplete-patterns or simply -Wall.

    As @badcook hinted in the comment, if you want GHC to also warn non-exhausive patterns in lambdas you should add -fwarn-incomplete-uni-patterns.