Hi Troels,

Sorry to hear GHC 9 didn't fix your problems! Yes, please open an issue.

Optimising for specific usage patterns might be feasible, although note that most often it's not the exhaustivity check that is causing problems, but the check for overlapping patterns.
At the moment the checker doesn't take shortcuts if we have -Wincomplete-patterns, but -Wno-overlapping-patterns. Maybe it could? Let's see what is causing you problems and decide then.

Cheers,
Sebastian

Am So., 28. März 2021 um 15:44 Uhr schrieb Troels Henriksen <athas@sigkill.dk>:
Troels Henriksen <athas@sigkill.dk> writes:

> It is very likely that issue 17386 is the issue.  With
>
> {-# OPTIONS_GHC -Wno-overlapping-patterns -Wno-incomplete-patterns
> -Wno-incomplete-uni-patterns -Wno-incomplete-record-updates #-}
>
> my module(s) compile very quickly.  I'll wait and see if GHC 9 does
> better before I try to create a smaller case (and now I at least have a
> workaround).

I have now tried it with GHC 9, and unfortunately it is still very slow.

As time permits, I will see if I can come up with a self-contained
module that illustrates the slowdown.

I do have an idea for a optimisation: In all of the cases where coverage
tracking takes a long time, I have a catch-all case at the bottom.  I
think that is a fairly common pattern, where a program tries to detect
various special cases, before falling back to a general case.  Perhaps
coverage checking should have a short-circuiting check for whether there
is an obvious catch-all case, and if so, not bother looking any closer?

--
\  Troels
/\ Henriksen