Create and use lenses for ProcessedTerm and Module #1866
Merged
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.
Splitting out an independent refactoring to simplify #1865. There were many places in the code where we were pattern-matching on
ProcessedTerm
and/orModule
, sometimes only to extract a single field, e.g.This was already getting a bit out of hand, and it also meant that any time we wanted to add an extra field to either
ProcessedTerm
orModule
(as I will be doing in #1865), we would have to change every single such place in the code to add an extra wildcard pattern.This PR is a refactoring to
ProcessedTerm
andModule
, andThere were a few places in the code where we destructure a
ProcessedTerm
and use almost all the fields (e.g. when initializing a robot machine); I left those alone, first because extracting all the individual fields would be tedious, but more importantly because if we ever added any new fields in the future, it's likely we would actually want to use them in those contexts as well.