Skip to content

panic! compiling Y combinator with optimizations

The following causes GHC 7.6.3, 7.8.3 and 7.10.1 (at least) to panic when compiling with optimizations:

module Y (y) where

newtype Rec a = Rec { out :: Rec a -> a}

k x = out x x

y f = (f . k) (Rec (f . k))
/tmp ««« ghc -O y.hs -fforce-recomp
[1 of 1] Compiling Y                ( y.hs, y.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.10.1 for x86_64-unknown-linux):
        Simplifier ticks exhausted
  When trying UnfoldingDone a_sof
  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: 5282
Trac metadata
Trac field Value
Version 7.10.1
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