[ elab ] Support more applicative traversals of TTImp
#3130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I propose to allow a bit more applicable, applicative mapping of
TTImp
s, which generalises existingmapMTTImp
way.Proposed way allows you to do, for example, the following. Since traversal goes bottom up, from leaves up to the root, there might be not enough information of whether some transformation should be done, or not. Consider you want some transformation happen, but want to cancel it if some condition happens. You may need an original value at this point. The proposed addition of
mapMMTTImp
(along with existingmapMTTImp
) allows this:Running
mapMMTTImp condTrans expr
, you have both original subexpression and the transformed one inside thecondTrans
function, allowing you to control precisely whether or not any particular change should be done.Should this change go in the CHANGELOG?
implementation, I have updated
CHANGELOG.md
(and potentially alsoCONTRIBUTORS.md
).