con-kitty / categorifier

Interpret Haskell programs into any cartesian closed category.
BSD 3-Clause "New" or "Revised" License
57 stars 2 forks source link

Call `occurAnalyseExpr` before plugin starts #59

Closed zliu41 closed 7 months ago

zliu41 commented 2 years ago

The reason that in the Plugins.Let case, v's OccInfo is always ManyOccs (#22), may be that the occurrence analysis simply isn't run before the plugin, for whatever reason (-O0?). If so, we can simply run it ourselves.

sellout commented 7 months ago

The “may” in the description has caused me to ignore this PR for a while. Do we have evidence that this actually works? If not, this should probably move to draft status until we can test it (perhaps ideally by adding golden tests – although those are very GHC-version-dependent, which is a pain).

zliu41 commented 7 months ago

I'm not even sure whether or not

v's OccInfo is always ManyOccs

is still the case. When we had the presimplifier, it is possible that GHC performs occurrence analysis before the presimplifier, and the presimplifier somehow messes things up. Now presimplifier is gone, and we need to double check whether the problem still exists. I'll just close the PR.