Simplifier ticks exhausted (when trying UnfoldingDone) from using lots of ByteString Builder literals
I've tried to port Cabal's Distribution.Simple.Build.PathsModule from Strings to Data.ByteString.Builder. The module uses lot's of string literals combined via ++. After enabling OverloadedStrings and changing ++ to Data.Semigroup.<> I got an error message like in the subject.
I have reproduced the issue on self-contained example, attached.
$ cd "/tmp/ghc-ticks-exhausted-bug/" && stack build
test-0.1.0.0: configure (lib)
Configuring test-0.1.0.0...
test-0.1.0.0: build (lib)
Preprocessing library test-0.1.0.0...
[1 of 1] Compiling Test ( Test.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Test.o )
/tmp/ghc-ticks-exhausted-bug/Test.hs:17:21: warning: [-Wunused-top-binds]
Defined but not used: data constructor ‘Linux’
/tmp/ghc-ticks-exhausted-bug/Test.hs:22:29: warning: [-Wunused-top-binds]
Defined but not used: data constructor ‘Arm’
<no location info>: error:
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
Simplifier ticks exhausted
When trying UnfoldingDone $
To increase the limit, use -fsimpl-tick-factor=N (default 100)
If you need to do this, let GHC HQ know, and what factor you needed
To see detailed counts use -ddump-simpl-stats
Total ticks: 184333
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
-- While building package test-0.1.0.0 using:
/home/sergey/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 build lib:test --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Edited by Sergey Vinokurov