Skip to content
  • Simon Peyton Jones's avatar
    Improve eta reduction, to reduce Simplifier iterations · a5f2ab64
    Simon Peyton Jones authored
    I finally got around to investigating why the Simplifier was sometimes
    iterating so often.  There's a nice example in Text.ParserCombinators.ReadPrec,
    which produced:
    
    NOTE: Simplifier still going after 3 iterations; bailing out.  Size = 339
    NOTE: Simplifier still going after 3 iterations; bailing out.  Size = 339
    NOTE: Simplifier still going after 3 iterations; bailing out.  Size = 339
    
    No progress is being made.  It turned out that an interaction between
    eta-expansion, casts, and eta reduction was responsible. The change is
    small and simple, in SimplUtils.mkLam: do not require the body to be
    a Lam when floating the cast outwards.  
    
    I also discovered a missing side condition in the same equation, so fixing
    that is good too.  Now there is no loop when compiling ReadPrec.
    
    Should do a full nofib run though.
    a5f2ab64