Skip to content

[#665] Apply dipDrop2swapDrop in a separate stage, and refactor how stages work

Nikolay Yakimov requested to merge lierdakil/#665-adjacent-dips-blocked into master

Description

Problem: dipDrop2swapDrop rule blocks adjacentDIPs.

Solution: First run main stage rules without dipDrop2swapDrop, then run them plus dipDrop2swapDrop. dipDrop2swapDrop can open up opportunities for further optimization, hence it needs to be run with other rules in tandem.

Problem: Currently, optimizer rules are represented as list of stages, where each stage is constructed as orSimpleRule flattenSeqLHS .... This makes the architecture not very pluggable.

Solution: Represent the ruleset as a newtype over IntMap (NonEmpty Rule). Add utilities for working with this type. When running the rules, fold the NonEmpty representing the stage using orSimpleRule with flattenSeqLHS as initial.

Related issue(s)

Resolves #

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Merge request reports