... | @@ -11,169 +11,178 @@ we describe the problem and the algorithm. It forms part of GHC 8.0. |
... | @@ -11,169 +11,178 @@ we describe the problem and the algorithm. It forms part of GHC 8.0. |
|
The ticket [\#11528](https://gitlab.haskell.org//ghc/ghc/issues/11528) tracks our aspiration to return to a more elegant (but currently less performant) implementation.
|
|
The ticket [\#11528](https://gitlab.haskell.org//ghc/ghc/issues/11528) tracks our aspiration to return to a more elegant (but currently less performant) implementation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Tickets should include `PatternMatchWarnings` in their Keywords to appear in these summary lists.
|
|
Tickets should include `PatternMatchWarnings` in their Keywords to appear in these summary lists.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Open Tickets:**
|
|
**Open Tickets:**
|
|
|
|
|
|
<table><tr><th>[\#10116](https://gitlab.haskell.org//ghc/ghc/issues/10116)</th>
|
|
<table><tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/10116">#10116</a></th>
|
|
<td>Closed type families: Warn if it doesn't handle all cases</td></tr>
|
|
<td>Closed type families: Warn if it doesn't handle all cases</td></tr>
|
|
<tr><th>[\#11195](https://gitlab.haskell.org//ghc/ghc/issues/11195)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11195">#11195</a></th>
|
|
<td>New pattern-match check can be non-performant</td></tr>
|
|
<td>New pattern-match check can be non-performant</td></tr>
|
|
<tr><th>[\#11253](https://gitlab.haskell.org//ghc/ghc/issues/11253)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11253">#11253</a></th>
|
|
<td>Duplicate warnings for pattern guards and relevant features (e.g. View Patterns)</td></tr>
|
|
<td>Duplicate warnings for pattern guards and relevant features (e.g. View Patterns)</td></tr>
|
|
<tr><th>[\#11503](https://gitlab.haskell.org//ghc/ghc/issues/11503)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11503">#11503</a></th>
|
|
<td>TypeError woes (incl. pattern match checker)</td></tr>
|
|
<td>TypeError woes (incl. pattern match checker)</td></tr>
|
|
<tr><th>[\#11528](https://gitlab.haskell.org//ghc/ghc/issues/11528)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11528">#11528</a></th>
|
|
<td>Representation of value set abstractions as trees causes performance issues</td></tr>
|
|
<td>Representation of value set abstractions as trees causes performance issues</td></tr>
|
|
<tr><th>[\#11822](https://gitlab.haskell.org//ghc/ghc/issues/11822)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11822">#11822</a></th>
|
|
<td>Pattern match checker exceeded (2000000) iterations</td></tr>
|
|
<td>Pattern match checker exceeded (2000000) iterations</td></tr>
|
|
<tr><th>[\#12694](https://gitlab.haskell.org//ghc/ghc/issues/12694)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/12694">#12694</a></th>
|
|
<td>GHC HEAD no longer reports inaccessible code</td></tr>
|
|
<td>GHC HEAD no longer reports inaccessible code</td></tr>
|
|
<tr><th>[\#12949](https://gitlab.haskell.org//ghc/ghc/issues/12949)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/12949">#12949</a></th>
|
|
<td>Pattern coverage checker ignores dictionary arguments</td></tr>
|
|
<td>Pattern coverage checker ignores dictionary arguments</td></tr>
|
|
<tr><th>[\#13021](https://gitlab.haskell.org//ghc/ghc/issues/13021)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13021">#13021</a></th>
|
|
<td>Inaccessible RHS warning is confusing for users</td></tr>
|
|
<td>Inaccessible RHS warning is confusing for users</td></tr>
|
|
<tr><th>[\#13363](https://gitlab.haskell.org//ghc/ghc/issues/13363)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13363">#13363</a></th>
|
|
<td>Wildcard patterns and COMPLETE sets can lead to misleading redundant pattern-match warnings</td></tr>
|
|
<td>Wildcard patterns and COMPLETE sets can lead to misleading redundant pattern-match warnings</td></tr>
|
|
<tr><th>[\#13717](https://gitlab.haskell.org//ghc/ghc/issues/13717)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13717">#13717</a></th>
|
|
<td>Pattern synonym exhaustiveness checks don't play well with EmptyCase</td></tr>
|
|
<td>Pattern synonym exhaustiveness checks don't play well with EmptyCase</td></tr>
|
|
<tr><th>[\#13766](https://gitlab.haskell.org//ghc/ghc/issues/13766)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13766">#13766</a></th>
|
|
<td>Confusing "redundant pattern match" in 8.0, no warning at all in 8.2</td></tr>
|
|
<td>Confusing "redundant pattern match" in 8.0, no warning at all in 8.2</td></tr>
|
|
<tr><th>[\#13964](https://gitlab.haskell.org//ghc/ghc/issues/13964)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13964">#13964</a></th>
|
|
<td>Pattern-match warnings for datatypes with COMPLETE sets break abstraction</td></tr>
|
|
<td>Pattern-match warnings for datatypes with COMPLETE sets break abstraction</td></tr>
|
|
<tr><th>[\#13965](https://gitlab.haskell.org//ghc/ghc/issues/13965)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13965">#13965</a></th>
|
|
<td>COMPLETE sets nerf redundant pattern-match warnings</td></tr>
|
|
<td>COMPLETE sets nerf redundant pattern-match warnings</td></tr>
|
|
<tr><th>[\#14059](https://gitlab.haskell.org//ghc/ghc/issues/14059)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14059">#14059</a></th>
|
|
<td>COMPLETE sets don't work at all with data family instances</td></tr>
|
|
<td>COMPLETE sets don't work at all with data family instances</td></tr>
|
|
<tr><th>[\#14133](https://gitlab.haskell.org//ghc/ghc/issues/14133)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14133">#14133</a></th>
|
|
<td>COMPLETE pragmas seem to be ignored when using view patterns</td></tr>
|
|
<td>COMPLETE pragmas seem to be ignored when using view patterns</td></tr>
|
|
<tr><th>[\#14253](https://gitlab.haskell.org//ghc/ghc/issues/14253)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14253">#14253</a></th>
|
|
<td>Pattern match checker mistakenly concludes pattern match on pattern synonym is unreachable</td></tr>
|
|
<td>Pattern match checker mistakenly concludes pattern match on pattern synonym is unreachable</td></tr>
|
|
<tr><th>[\#14838](https://gitlab.haskell.org//ghc/ghc/issues/14838)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14838">#14838</a></th>
|
|
<td>missing "incomplete-patterns" warning for TH-generated functions</td></tr>
|
|
<td>missing "incomplete-patterns" warning for TH-generated functions</td></tr>
|
|
<tr><th>[\#14851](https://gitlab.haskell.org//ghc/ghc/issues/14851)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14851">#14851</a></th>
|
|
<td>"Pattern match has inaccessible right hand side" with TypeRep</td></tr>
|
|
<td>"Pattern match has inaccessible right hand side" with TypeRep</td></tr>
|
|
<tr><th>[\#14899](https://gitlab.haskell.org//ghc/ghc/issues/14899)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14899">#14899</a></th>
|
|
<td>Significant compilation time regression between 8.4 and HEAD due to coverage checking</td></tr>
|
|
<td>Significant compilation time regression between 8.4 and HEAD due to coverage checking</td></tr>
|
|
<tr><th>[\#14987](https://gitlab.haskell.org//ghc/ghc/issues/14987)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14987">#14987</a></th>
|
|
<td>Memory usage exploding for complex pattern matching</td></tr>
|
|
<td>Memory usage exploding for complex pattern matching</td></tr>
|
|
<tr><th>[\#15014](https://gitlab.haskell.org//ghc/ghc/issues/15014)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15014">#15014</a></th>
|
|
<td>Exhaustivity check should suggest when COMPLETE could be helpful</td></tr>
|
|
<td>Exhaustivity check should suggest when COMPLETE could be helpful</td></tr>
|
|
<tr><th>[\#15554](https://gitlab.haskell.org//ghc/ghc/issues/15554)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15554">#15554</a></th>
|
|
<td>COMPLETE pragmas make overlapping-patterns warnings behave oddly</td></tr>
|
|
<td>COMPLETE pragmas make overlapping-patterns warnings behave oddly</td></tr>
|
|
<tr><th>[\#15681](https://gitlab.haskell.org//ghc/ghc/issues/15681)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15681">#15681</a></th>
|
|
<td>Take exhaustiveness checking into consideration when using MonadFailDesugaring</td></tr>
|
|
<td>Take exhaustiveness checking into consideration when using MonadFailDesugaring</td></tr>
|
|
<tr><th>[\#15713](https://gitlab.haskell.org//ghc/ghc/issues/15713)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15713">#15713</a></th>
|
|
<td>Bogus -Woverlapping-patterns warning with OverloadedStrings</td></tr>
|
|
<td>Bogus -Woverlapping-patterns warning with OverloadedStrings</td></tr>
|
|
<tr><th>[\#15744](https://gitlab.haskell.org//ghc/ghc/issues/15744)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15744">#15744</a></th>
|
|
<td>Existence of complete pattern synonym hides unrelated incomplete pattern warning</td></tr>
|
|
<td>Existence of complete pattern synonym hides unrelated incomplete pattern warning</td></tr>
|
|
<tr><th>[\#15753](https://gitlab.haskell.org//ghc/ghc/issues/15753)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15753">#15753</a></th>
|
|
<td>Inconsistent pattern-match warnings when using guards versus case expressions</td></tr>
|
|
<td>Inconsistent pattern-match warnings when using guards versus case expressions</td></tr>
|
|
<tr><th>[\#15885](https://gitlab.haskell.org//ghc/ghc/issues/15885)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15885">#15885</a></th>
|
|
<td>Enhancing COMPLETE pragma to support pattern synonyms with polymorphic (output) types</td></tr>
|
|
<td>Enhancing COMPLETE pragma to support pattern synonyms with polymorphic (output) types</td></tr>
|
|
<tr><th>[\#16128](https://gitlab.haskell.org//ghc/ghc/issues/16128)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/16128">#16128</a></th>
|
|
<td>Pattern match checker should shortcut on simple cases</td></tr>
|
|
<td>Pattern match checker should shortcut on simple cases</td></tr>
|
|
<tr><th>[\#16278](https://gitlab.haskell.org//ghc/ghc/issues/16278)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/16278">#16278</a></th>
|
|
<td>Exhaustivity checking GADT with free variables</td></tr>
|
|
<td>Exhaustivity checking GADT with free variables</td></tr>
|
|
<tr><th>[\#16289](https://gitlab.haskell.org//ghc/ghc/issues/16289)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/16289">#16289</a></th>
|
|
<td>GHC thinks pattern match is exhaustive</td></tr></table>
|
|
<td>GHC thinks pattern match is exhaustive</td></tr></table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Closed Tickets:**
|
|
**Closed Tickets:**
|
|
|
|
|
|
<table><tr><th>[\#322](https://gitlab.haskell.org//ghc/ghc/issues/322)</th>
|
|
<table><tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/322">#322</a></th>
|
|
<td>fromInteger-related pattern match overlap warnings</td></tr>
|
|
<td>fromInteger-related pattern match overlap warnings</td></tr>
|
|
<tr><th>[\#595](https://gitlab.haskell.org//ghc/ghc/issues/595)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/595">#595</a></th>
|
|
<td>Overhaul GHC's overlapping/non-exhaustive pattern checking</td></tr>
|
|
<td>Overhaul GHC's overlapping/non-exhaustive pattern checking</td></tr>
|
|
<tr><th>[\#2204](https://gitlab.haskell.org//ghc/ghc/issues/2204)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/2204">#2204</a></th>
|
|
<td>Improve 'patterns not matched' warnings</td></tr>
|
|
<td>Improve 'patterns not matched' warnings</td></tr>
|
|
<tr><th>[\#3927](https://gitlab.haskell.org//ghc/ghc/issues/3927)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/3927">#3927</a></th>
|
|
<td>Incomplete/overlapped pattern warnings + GADTs = inadequate</td></tr>
|
|
<td>Incomplete/overlapped pattern warnings + GADTs = inadequate</td></tr>
|
|
<tr><th>[\#4139](https://gitlab.haskell.org//ghc/ghc/issues/4139)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/4139">#4139</a></th>
|
|
<td>Spurious non-exhaustive pattern match warnings are given using GADTs</td></tr>
|
|
<td>Spurious non-exhaustive pattern match warnings are given using GADTs</td></tr>
|
|
<tr><th>[\#5724](https://gitlab.haskell.org//ghc/ghc/issues/5724)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/5724">#5724</a></th>
|
|
<td>Confusing warning message for incomplete patterns</td></tr>
|
|
<td>Confusing warning message for incomplete patterns</td></tr>
|
|
<tr><th>[\#5728](https://gitlab.haskell.org//ghc/ghc/issues/5728)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/5728">#5728</a></th>
|
|
<td>Warnings from -fwarn-incomplete-record-updates even with all constructors matched</td></tr>
|
|
<td>Warnings from -fwarn-incomplete-record-updates even with all constructors matched</td></tr>
|
|
<tr><th>[\#5762](https://gitlab.haskell.org//ghc/ghc/issues/5762)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/5762">#5762</a></th>
|
|
<td>GHC gives incorrect warnings with simple applications of the view patterns extension</td></tr>
|
|
<td>GHC gives incorrect warnings with simple applications of the view patterns extension</td></tr>
|
|
<tr><th>[\#6124](https://gitlab.haskell.org//ghc/ghc/issues/6124)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/6124">#6124</a></th>
|
|
<td>Spurious non-exhaustive warning with GADT and newtypes</td></tr>
|
|
<td>Spurious non-exhaustive warning with GADT and newtypes</td></tr>
|
|
<tr><th>[\#7669](https://gitlab.haskell.org//ghc/ghc/issues/7669)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/7669">#7669</a></th>
|
|
<td>Empty case causes warning</td></tr>
|
|
<td>Empty case causes warning</td></tr>
|
|
<tr><th>[\#8016](https://gitlab.haskell.org//ghc/ghc/issues/8016)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/8016">#8016</a></th>
|
|
<td>case expression with mixed use of Num instances cause spurious overlap warning</td></tr>
|
|
<td>case expression with mixed use of Num instances cause spurious overlap warning</td></tr>
|
|
<tr><th>[\#8494](https://gitlab.haskell.org//ghc/ghc/issues/8494)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/8494">#8494</a></th>
|
|
<td>Warn if a pattern guard obviates all others</td></tr>
|
|
<td>Warn if a pattern guard obviates all others</td></tr>
|
|
<tr><th>[\#8710](https://gitlab.haskell.org//ghc/ghc/issues/8710)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/8710">#8710</a></th>
|
|
<td>Overlapping patterns warning misplaced</td></tr>
|
|
<td>Overlapping patterns warning misplaced</td></tr>
|
|
<tr><th>[\#8853](https://gitlab.haskell.org//ghc/ghc/issues/8853)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/8853">#8853</a></th>
|
|
<td>Surprising mention of unboxed integers in pattern exhaustiveness warning</td></tr>
|
|
<td>Surprising mention of unboxed integers in pattern exhaustiveness warning</td></tr>
|
|
<tr><th>[\#8970](https://gitlab.haskell.org//ghc/ghc/issues/8970)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/8970">#8970</a></th>
|
|
<td>Non-exhaustive pattern match warning with DataKinds and TypeFamilies</td></tr>
|
|
<td>Non-exhaustive pattern match warning with DataKinds and TypeFamilies</td></tr>
|
|
<tr><th>[\#9113](https://gitlab.haskell.org//ghc/ghc/issues/9113)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/9113">#9113</a></th>
|
|
<td>Template Haskell should warn about non-exhaustive pattern matches</td></tr>
|
|
<td>Template Haskell should warn about non-exhaustive pattern matches</td></tr>
|
|
<tr><th>[\#9951](https://gitlab.haskell.org//ghc/ghc/issues/9951)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/9951">#9951</a></th>
|
|
<td>OverloadedLists breaks exhaustiveness check</td></tr>
|
|
<td>OverloadedLists breaks exhaustiveness check</td></tr>
|
|
<tr><th>[\#10393](https://gitlab.haskell.org//ghc/ghc/issues/10393)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/10393">#10393</a></th>
|
|
<td>Bogus warning with OverloadedLists</td></tr>
|
|
<td>Bogus warning with OverloadedLists</td></tr>
|
|
<tr><th>[\#10746](https://gitlab.haskell.org//ghc/ghc/issues/10746)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/10746">#10746</a></th>
|
|
<td>No non-exhaustive pattern match warning given for empty case analysis</td></tr>
|
|
<td>No non-exhaustive pattern match warning given for empty case analysis</td></tr>
|
|
<tr><th>[\#11160](https://gitlab.haskell.org//ghc/ghc/issues/11160)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11160">#11160</a></th>
|
|
<td>New exhaustiveness checker breaks ghcirun004</td></tr>
|
|
<td>New exhaustiveness checker breaks ghcirun004</td></tr>
|
|
<tr><th>[\#11161](https://gitlab.haskell.org//ghc/ghc/issues/11161)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11161">#11161</a></th>
|
|
<td>New exhaustiveness checker breaks concurrent/prog001</td></tr>
|
|
<td>New exhaustiveness checker breaks concurrent/prog001</td></tr>
|
|
<tr><th>[\#11162](https://gitlab.haskell.org//ghc/ghc/issues/11162)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11162">#11162</a></th>
|
|
<td>T783 regresses severely in allocations with new pattern match checker</td></tr>
|
|
<td>T783 regresses severely in allocations with new pattern match checker</td></tr>
|
|
<tr><th>[\#11163](https://gitlab.haskell.org//ghc/ghc/issues/11163)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11163">#11163</a></th>
|
|
<td>New exhaustiveness checker breaks T5642</td></tr>
|
|
<td>New exhaustiveness checker breaks T5642</td></tr>
|
|
<tr><th>[\#11276](https://gitlab.haskell.org//ghc/ghc/issues/11276)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11276">#11276</a></th>
|
|
<td>GHC hangs/takes an exponential amount of time with simple program</td></tr>
|
|
<td>GHC hangs/takes an exponential amount of time with simple program</td></tr>
|
|
<tr><th>[\#11302](https://gitlab.haskell.org//ghc/ghc/issues/11302)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11302">#11302</a></th>
|
|
<td>GHC HEAD uses up all memory while compiling \`genprimcode\`</td></tr>
|
|
<td>GHC HEAD uses up all memory while compiling `genprimcode`</td></tr>
|
|
<tr><th>[\#11303](https://gitlab.haskell.org//ghc/ghc/issues/11303)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11303">#11303</a></th>
|
|
<td>Pattern matching against sets of strings sharing a prefix blows up pattern checker</td></tr>
|
|
<td>Pattern matching against sets of strings sharing a prefix blows up pattern checker</td></tr>
|
|
<tr><th>[\#11316](https://gitlab.haskell.org//ghc/ghc/issues/11316)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11316">#11316</a></th>
|
|
<td>Too many guards warning causes issues</td></tr>
|
|
<td>Too many guards warning causes issues</td></tr>
|
|
<tr><th>[\#11374](https://gitlab.haskell.org//ghc/ghc/issues/11374)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11374">#11374</a></th>
|
|
<td>\`-Woverlapping-patterns\` induced memory-blowup</td></tr>
|
|
<td>`-Woverlapping-patterns` induced memory-blowup</td></tr>
|
|
<tr><th>[\#11390](https://gitlab.haskell.org//ghc/ghc/issues/11390)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11390">#11390</a></th>
|
|
<td>GHC does not warn about redundant patterns</td></tr>
|
|
<td>GHC does not warn about redundant patterns</td></tr>
|
|
<tr><th>[\#11806](https://gitlab.haskell.org//ghc/ghc/issues/11806)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11806">#11806</a></th>
|
|
<td>GHC does not warn for mistakenly empty case</td></tr>
|
|
<td>GHC does not warn for mistakenly empty case</td></tr>
|
|
<tr><th>[\#11984](https://gitlab.haskell.org//ghc/ghc/issues/11984)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11984">#11984</a></th>
|
|
<td>Pattern match incompleteness / inaccessibility discrepancy</td></tr>
|
|
<td>Pattern match incompleteness / inaccessibility discrepancy</td></tr>
|
|
<tr><th>[\#12158](https://gitlab.haskell.org//ghc/ghc/issues/12158)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/12158">#12158</a></th>
|
|
<td>ghc: panic! (the 'impossible' happened) translateConPatVec: lookup</td></tr>
|
|
<td>ghc: panic! (the 'impossible' happened) translateConPatVec: lookup</td></tr>
|
|
<tr><th>[\#13517](https://gitlab.haskell.org//ghc/ghc/issues/13517)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13517">#13517</a></th>
|
|
<td>No warnings produced, yet the pattern matching fails at runtime.</td></tr>
|
|
<td>No warnings produced, yet the pattern matching fails at runtime.</td></tr>
|
|
<tr><th>[\#14098](https://gitlab.haskell.org//ghc/ghc/issues/14098)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14098">#14098</a></th>
|
|
<td>Incorrect pattern match warning on nested GADTs</td></tr>
|
|
<td>Incorrect pattern match warning on nested GADTs</td></tr>
|
|
<tr><th>[\#14546](https://gitlab.haskell.org//ghc/ghc/issues/14546)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14546">#14546</a></th>
|
|
<td>-Woverlapping-patterns warns on wrong patterns for Int</td></tr>
|
|
<td>-Woverlapping-patterns warns on wrong patterns for Int</td></tr>
|
|
<tr><th>[\#14547](https://gitlab.haskell.org//ghc/ghc/issues/14547)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14547">#14547</a></th>
|
|
<td>Wrong warning by -Wincomplete-patterns</td></tr>
|
|
<td>Wrong warning by -Wincomplete-patterns</td></tr>
|
|
<tr><th>[\#14773](https://gitlab.haskell.org//ghc/ghc/issues/14773)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14773">#14773</a></th>
|
|
<td>MultiWayIf makes it easy to write partial programs that are not catched by -Wall</td></tr>
|
|
<td>MultiWayIf makes it easy to write partial programs that are not catched by -Wall</td></tr>
|
|
<tr><th>[\#14813](https://gitlab.haskell.org//ghc/ghc/issues/14813)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14813">#14813</a></th>
|
|
<td>EmptyCase thinks pattern match involving type family is not exhaustive, when it actually is</td></tr>
|
|
<td>EmptyCase thinks pattern match involving type family is not exhaustive, when it actually is</td></tr>
|
|
<tr><th>[\#15305](https://gitlab.haskell.org//ghc/ghc/issues/15305)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15305">#15305</a></th>
|
|
<td>Erroneous "non-exhaustive pattern match" using nested GADT with strictness annotation</td></tr>
|
|
<td>Erroneous "non-exhaustive pattern match" using nested GADT with strictness annotation</td></tr>
|
|
<tr><th>[\#15385](https://gitlab.haskell.org//ghc/ghc/issues/15385)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15385">#15385</a></th>
|
|
<td>-Wincomplete-patterns gets confused when combining GADTs and pattern guards</td></tr>
|
|
<td>-Wincomplete-patterns gets confused when combining GADTs and pattern guards</td></tr>
|
|
<tr><th>[\#15398](https://gitlab.haskell.org//ghc/ghc/issues/15398)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15398">#15398</a></th>
|
|
<td>GADT deriving Ord generates inaccessible code in a pattern with constructor.</td></tr>
|
|
<td>GADT deriving Ord generates inaccessible code in a pattern with constructor.</td></tr>
|
|
<tr><th>[\#15450](https://gitlab.haskell.org//ghc/ghc/issues/15450)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15450">#15450</a></th>
|
|
<td>Inconsistency w.r.t. coverage checking warnings for EmptyCase under unsatisfiable constraints</td></tr>
|
|
<td>Inconsistency w.r.t. coverage checking warnings for EmptyCase under unsatisfiable constraints</td></tr>
|
|
<tr><th>[\#15584](https://gitlab.haskell.org//ghc/ghc/issues/15584)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15584">#15584</a></th>
|
|
<td>nonVoid is too conservative w.r.t. strict argument types</td></tr>
|
|
<td>nonVoid is too conservative w.r.t. strict argument types</td></tr>
|
|
<tr><th>[\#15884](https://gitlab.haskell.org//ghc/ghc/issues/15884)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15884">#15884</a></th>
|
|
<td>Completeness of View Patterns With a Complete Set of Output Patterns</td></tr>
|
|
<td>Completeness of View Patterns With a Complete Set of Output Patterns</td></tr>
|
|
<tr><th>[\#15886](https://gitlab.haskell.org//ghc/ghc/issues/15886)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/15886">#15886</a></th>
|
|
<td>Spurious warning about incomplete pattern with PatternSynonyms</td></tr>
|
|
<td>Spurious warning about incomplete pattern with PatternSynonyms</td></tr>
|
|
<tr><th>[\#16129](https://gitlab.haskell.org//ghc/ghc/issues/16129)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/16129">#16129</a></th>
|
|
<td>Incorrect non-exhaustive pattern warning with PatternSynonyms</td></tr>
|
|
<td>Incorrect non-exhaustive pattern warning with PatternSynonyms</td></tr>
|
|
<tr><th>[\#16377](https://gitlab.haskell.org//ghc/ghc/issues/16377)</th>
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/16377">#16377</a></th>
|
|
<td>\`TypeError\` in a pattern should flag inaccessible code</td></tr></table>
|
|
<td>`TypeError` in a pattern should flag inaccessible code</td></tr></table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Background**:
|
|
**Background**:
|
|
|
|
|
... | @@ -218,8 +227,15 @@ Tickets should include `PatternMatchWarnings` in their Keywords to appear in the |
... | @@ -218,8 +227,15 @@ Tickets should include `PatternMatchWarnings` in their Keywords to appear in the |
|
Since GHC's exhaustiveness/redundancy checker was outdated, it did not take into account constraints introduced
|
|
Since GHC's exhaustiveness/redundancy checker was outdated, it did not take into account constraints introduced
|
|
by GADT matches when reporting warnings. This is illustrated in the following example ([\#3927](https://gitlab.haskell.org//ghc/ghc/issues/3927)):
|
|
by GADT matches when reporting warnings. This is illustrated in the following example ([\#3927](https://gitlab.haskell.org//ghc/ghc/issues/3927)):
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
dataT a whereT1::TIntT2::TBoolf::T a ->T a ->BoolfT1T1=TruefT2T2=False
|
|
data T a where
|
|
|
|
T1 :: T Int
|
|
|
|
T2 :: T Bool
|
|
|
|
|
|
|
|
f :: T a -> T a -> Bool
|
|
|
|
f T1 T1 = True
|
|
|
|
f T2 T2 = False
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
... | @@ -237,16 +253,22 @@ Even though the above definition for `f` is exhaustive, we get a warning of the |
... | @@ -237,16 +253,22 @@ Even though the above definition for `f` is exhaustive, we get a warning of the |
|
Obviously, both pattern vectors issued as not matched, are ill-typed, because they both generate the inconsistent
|
|
Obviously, both pattern vectors issued as not matched, are ill-typed, because they both generate the inconsistent
|
|
constraint `Int ~ Bool`. This becomes more clear if we rewrite the definition of `T` in the equivalent form:
|
|
constraint `Int ~ Bool`. This becomes more clear if we rewrite the definition of `T` in the equivalent form:
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
dataT a whereT1:: forall a.(a ~Int)=>T a
|
|
data T a where
|
|
T2:: forall a.(a ~Bool)=>T a
|
|
T1 :: forall a. (a ~ Int) => T a
|
|
|
|
T2 :: forall a. (a ~ Bool) => T a
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
Additionally, if we add one more branch to `f`:
|
|
Additionally, if we add one more branch to `f`:
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
f::T a ->T a ->BoolfT1T1=TruefT2T2=Falsef__= undefined -- inaccessible
|
|
f :: T a -> T a -> Bool
|
|
|
|
f T1 T1 = True
|
|
|
|
f T2 T2 = False
|
|
|
|
f _ _ = undefined -- inaccessible
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
... | @@ -307,7 +329,7 @@ For example, for function `f` above we have: |
... | @@ -307,7 +329,7 @@ For example, for function `f` above we have: |
|
- initial_missing = `[(x y)]` where `x :: T a` and `y :: T a`
|
|
- initial_missing = `[(x y)]` where `x :: T a` and `y :: T a`
|
|
|
|
|
|
```
|
|
```
|
|
fT1T1=True-- first clause
|
|
f T1 T1 = True -- first clause
|
|
```
|
|
```
|
|
- Covers `[(T1 T1 |> {a ~ Int, a ~ Int})]`
|
|
- Covers `[(T1 T1 |> {a ~ Int, a ~ Int})]`
|
|
- Forces the evaluation of the 1st argument
|
|
- Forces the evaluation of the 1st argument
|
... | @@ -333,8 +355,9 @@ uncovered = [(T2 y |> {a ~ Bool})] |
... | @@ -333,8 +355,9 @@ uncovered = [(T2 y |> {a ~ Bool})] |
|
|
|
|
|
With this, we now process the second clause:
|
|
With this, we now process the second clause:
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
fT2T2=False-- second clause
|
|
f T2 T2 = False -- second clause
|
|
```
|
|
```
|
|
|
|
|
|
- Covers `[(T2 T2 |> {a ~ Bool, a ~ Bool})]`
|
|
- Covers `[(T2 T2 |> {a ~ Bool, a ~ Bool})]`
|
... | @@ -351,8 +374,9 @@ uncovered = [] |
... | @@ -351,8 +374,9 @@ uncovered = [] |
|
|
|
|
|
Finally, checking the last clause given that nothing is uncovered we get:
|
|
Finally, checking the last clause given that nothing is uncovered we get:
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
f__= undefined -- third clause (inaccessible)
|
|
f _ _ = undefined -- third clause (inaccessible)
|
|
```
|
|
```
|
|
|
|
|
|
- Covers: `[]`
|
|
- Covers: `[]`
|
... | @@ -372,25 +396,38 @@ term constraints so that we can handle guards (see section below). |
... | @@ -372,25 +396,38 @@ term constraints so that we can handle guards (see section below). |
|
# Pattern Guards
|
|
# Pattern Guards
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A pattern guard (`p <- e`) behaves exactly like if we had one more argument to pattern match against. For example:
|
|
A pattern guard (`p <- e`) behaves exactly like if we had one more argument to pattern match against. For example:
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
f x ::[a]->Boolf x |(z:zs)<- x =...
|
|
f x :: [a] -> Bool
|
|
|
|
f x | (z:zs) <- x = ...
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
is equivalent to:
|
|
is equivalent to:
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
g x ::[a]->[a]->Boolg x (z:zs)=...f::[a]->Boolf x = g x x
|
|
g x :: [a] -> [a] -> Bool
|
|
|
|
g x (z:zs) = ...
|
|
|
|
|
|
|
|
f :: [a] -> Bool
|
|
|
|
f x = g x x
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
Using this trick, we can reason about pattern guards in the same way we reason about normal pattern matching.
|
|
Using this trick, we can reason about pattern guards in the same way we reason about normal pattern matching.
|
|
Consider the following example:
|
|
Consider the following example:
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
-- the above example, written using guardsf::T a ->T a ->Boolf c d |T1<- c,T1<- d =True|T2<- c,T2<- d =False| otherwise = undefined -- inaccessible
|
|
-- the above example, written using guards
|
|
|
|
f :: T a -> T a -> Bool
|
|
|
|
f c d | T1 <- c, T1 <- d = True
|
|
|
|
| T2 <- c, T2 <- d = False
|
|
|
|
| otherwise = undefined -- inaccessible
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
... | @@ -437,10 +474,15 @@ cases: |
... | @@ -437,10 +474,15 @@ cases: |
|
### Example 1
|
|
### Example 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Consider the following function:
|
|
Consider the following function:
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
g::Bool->Bool->Boolg_True=TruegTrueTrue=Trueg__=False
|
|
g :: Bool -> Bool -> Bool
|
|
|
|
g _ True = True
|
|
|
|
g True True = True
|
|
|
|
g _ _ = False
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
... | @@ -488,10 +530,22 @@ By "useful" we mean that the RHS will be returned if matched. |
... | @@ -488,10 +530,22 @@ By "useful" we mean that the RHS will be returned if matched. |
|
### Example 2
|
|
### Example 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Interestingly, one can trigger this behaviour indirectly, using GADTs. Consider the function `h`:
|
|
Interestingly, one can trigger this behaviour indirectly, using GADTs. Consider the function `h`:
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
dataF a whereF1::FIntF2::FBooldataG a whereG1::GIntG2::GCharh::F a ->G a ->InthF1G1=1h_G1=2-- what about this clause?
|
|
data F a where
|
|
|
|
F1 :: F Int
|
|
|
|
F2 :: F Bool
|
|
|
|
|
|
|
|
data G a where
|
|
|
|
G1 :: G Int
|
|
|
|
G2 :: G Char
|
|
|
|
|
|
|
|
h :: F a -> G a -> Int
|
|
|
|
h F1 G1 = 1
|
|
|
|
h _ G1 = 2 -- what about this clause?
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
... | @@ -531,6 +585,19 @@ inaccessible `h`, indeed the only well-typed **values** that can match are `F1` |
... | @@ -531,6 +585,19 @@ inaccessible `h`, indeed the only well-typed **values** that can match are `F1` |
|
call-by-value, `F2 undefined` is a perfectly well-typed combination of arguments! Hence, this example illustrates
|
|
call-by-value, `F2 undefined` is a perfectly well-typed combination of arguments! Hence, this example illustrates
|
|
the following interesting behaviour:
|
|
the following interesting behaviour:
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
h1::F a ->G a ->Inth1F1G1=1h1_G1=2-- emits warning that the RHS is inaccessible-- but h1 is considered exhaustiveh2::F a ->G a ->Inth2F1G1=1-- emits a warning that h2 is non-exhaustive with (F2 _) being the missing caseh3::F a ->G a ->Inth3F1G1=1h3F2_=2-- no warning for this one
|
|
h1 :: F a -> G a -> Int
|
|
|
|
h1 F1 G1 = 1
|
|
|
|
h1 _ G1 = 2 -- emits warning that the RHS is inaccessible
|
|
|
|
-- but h1 is considered exhaustive
|
|
|
|
|
|
|
|
h2 :: F a -> G a -> Int
|
|
|
|
h2 F1 G1 = 1
|
|
|
|
-- emits a warning that h2 is non-exhaustive with (F2 _) being the missing case
|
|
|
|
|
|
|
|
h3 :: F a -> G a -> Int
|
|
|
|
h3 F1 G1 = 1
|
|
|
|
h3 F2 _ = 2
|
|
|
|
-- no warning for this one
|
|
``` |
|
``` |
|
|
|
\ No newline at end of file |