Pattern matching desugaring regression? Re: [Haskell-cafe] Why does my module take so long to compile?

Troels Henriksen athas at sigkill.dk
Sun Mar 28 13:43:59 UTC 2021


Troels Henriksen <athas at 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


More information about the ghc-devs mailing list