[GHC] #15014: Exhaustivity check should suggest when COMPLETE could be helpful
GHC
ghc-devs at haskell.org
Sun Apr 8 23:18:12 UTC 2018
#15014: Exhaustivity check should suggest when COMPLETE could be helpful
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.4.3
Component: Compiler | Version: 8.5
(Type checker) |
Keywords: | Operating System: Unknown/Multiple
PatternSynonyms, |
PatternMatchWarnings |
Architecture: | Type of failure: Poor/confusing
Unknown/Multiple | error message
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
{{{
MacBook-Pro-97:ghc ezyang$ cat A.hs
{-# LANGUAGE PatternSynonyms #-}
module A where
pattern F :: a -> b -> (a, b)
pattern F x y = (x, y)
g :: (a, b) -> (a, b)
g (F x y) = (x, y)
MacBook-Pro-97:ghc ezyang$ inplace/bin/ghc-stage2 -c A.hs -Wall -fforce-
recomp
A.hs:8:1: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In an equation for āgā: Patterns not matched: _
|
8 | g (F x y) = (x, y)
| ^^^^^^^^^^^^^^^^^^
MacBook-Pro-97:ghc ezyang$ inplace/bin/ghc-stage2 --version
The Glorious Glasgow Haskell Compilation System, version 8.5.20180304
}}}
Any time the exhaustiveness checker throws up its hands and says that `_`
is not matched, we ought to give a hint that this may have occurred due to
pattern synonyms, and that the author of the pattern synonyms can help out
by specifying a COMPLETE pragma.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15014>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list