[GHC] #13011: Simplifier ticks exhausted: a 10-line case
GHC
ghc-devs at haskell.org
Tue Dec 20 12:04:05 UTC 2016
#13011: Simplifier ticks exhausted: a 10-line case
-------------------------------------+-------------------------------------
Reporter: L.K.Rebellion | Owner:
Type: bug | Status: new
Priority: high | Milestone:
Component: Compiler | Version: 8.0.1
Keywords: Simplifier | Operating System: Linux
ticks exhausted | Type of failure: Compile-time
Architecture: x86 | crash or panic
Test Case: | Blocked By:
Blocking: | Related Tickets: #8319 #12776
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
I was trying to define a function that could take itself as an argument.
{{{#!hs
newtype MobiusFn a = MobiusFn {
func :: MobiusFn a -> a
}
spin :: MobiusFn a -> a
spin mf = func mf mf
}}}
Use it to find suffixes of a `String`
{{{#!hs
suffixes :: String -> [String]
suffixes = spin $ MobiusFn suffixesMF
where suffixesMF _ [] = []
suffixesMF mf s@(_:xs) = s : spin mf xs
}}}
Add `main` and compile
{{{#!hs
main = readLn >>= (print . suffixes)
}}}
The compiler panicked with
{{{
[1 of 1] Compiling Main ( test.hs, test.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.1 for i386-unknown-linux):
Simplifier ticks exhausted
When trying UnfoldingDone mf_s1UD
}}}
But if we ignore the empty string case, it works well with non-empty
strings.
{{{#!hs
suffixes :: String -> [String]
suffixes = spin $ MobiusFn suffixesMF
where suffixesMF _ s@[_] = [s]
suffixesMF mf s@(_:xs) = s : spin mf xs
}}}
Two versions tested.
{{{
GHC version 8.0.1 for i386-unknown-linux
GHC version 7.10.3 for i386-unknown-linux
}}}
Thank you for reading.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13011>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list