Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,870
    • Issues 4,870
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13011
Closed
Open
Created Dec 20, 2016 by L.K.Rebellion@trac-L.K.Rebellion

Simplifier ticks exhausted: a 10-line case

I was trying to define a function that could take itself as an argument.

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

suffixes :: String -> [String]
suffixes = spin $ MobiusFn suffixesMF
    where suffixesMF _ [] = []
          suffixesMF mf s@(_:xs) = s : spin mf xs

Add main and compile

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.

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.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority high
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
Assignee
Assign to
Time tracking