Skip to content

Instantly share code, notes, and snippets.

@domenkozar
Created June 23, 2018 16:28
Show Gist options
  • Save domenkozar/30e4a02028bc00cfae95f78953bed8b1 to your computer and use it in GitHub Desktop.
Save domenkozar/30e4a02028bc00cfae95f78953bed8b1 to your computer and use it in GitHub Desktop.
Why does GHC emit warning?
{-# LANGUAGE RecordWildCards #-}
data Foo = Foo
{ a :: Bool
}
run :: Foo -> Bool
run Foo{..}
| a = a
| not a = not a
main :: IO ()
main = return ()
$ 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