Skip to content

ghc panic Simplifier ticks exhausted when trying UnfoldingDone x_alB

The following code causes a panic. It's the Y combinator.

module Y where

newtype F a = F { unF :: F a -> a }

y :: (a -> a) -> a
y = \f -> (\x -> x (F x)) (\x -> f (unF x x))
bash$ ~/src/ghc-7.10.0.20150123/installed/bin/ghc -c Y.hs
ghc: panic! (the 'impossible' happened)
  (GHC version 7.10.0.20150123 for x86_64-unknown-linux):
	Simplifier ticks exhausted
  When trying UnfoldingDone x_alB
  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: 4722

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

However it works fine in GHCi

bash$ ~/src/ghc-7.10.0.20150123/installed/bin/ghci Y.hs
GHCi, version 7.10.0.20150123: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Y                ( Y.hs, interpreted )
Ok, modules loaded: Y.
*Y> take 10 (y (1:))
[1,1,1,1,1,1,1,1,1,1]

I have tried this code with 7.6.3, 7.8.3 and 7.10.1-rc2. Same result.

At least in 7.10.1-rc2 it doesn't work even with -fsimpl-tick-factor=100000 (that's 10^5^)

Trac metadata
Trac field Value
Version 7.10.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information