Improve Simplifier and SpecConstr behaviour
Trac #4908 identified a case where SpecConstr wasn't "seeing" a specialisation it should easily get. The solution was simple: see Note [Add scrutinee to ValueEnv too] in SpecConstr. Then it turned out that there was an exactly analogous infelicity in the mighty Simplifer too; see Note [Add unfolding for scrutinee] in Simplify. This fix is good for Simplify even in the absence of the SpecConstr change. (It arose when I moved the binder- swap stuff to OccAnall, not realising that it *remains* valuable to record info about the scrutinee of a case expression. The Note says why. Together these two changes are unconditionally good. Better simplification, better specialisation. Thank you Max.
Showing with 96 additions and 56 deletions