Created
June 23, 2018 16:28
-
-
Save domenkozar/30e4a02028bc00cfae95f78953bed8b1 to your computer and use it in GitHub Desktop.
Why does GHC emit warning?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RecordWildCards #-} | |
data Foo = Foo | |
{ a :: Bool | |
} | |
run :: Foo -> Bool | |
run Foo{..} | |
| a = a | |
| not a = not a | |
main :: IO () | |
main = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ runghc -- -fwarn-incomplete-patterns -Wall exaustive.hs | |
exaustive.hs:10:1: warning: [-Wincomplete-patterns] | |
Pattern match(es) are non-exhaustive | |
In an equation for ‘run’: Patterns not matched: (Foo False) | |
| | |
10 | run Foo{..} | |
| ^^^^^^^^^^^... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment