We noticed a few cases while reviewing #72 where the optimised fixer functions could be further reduced. This PR makes a few changes:
Support poking into Fold algebras and rewriting the internal functions, allowing compositions to be optimised
Merge composed functions applying to lenses with a common prefix by extracting that prefix out as a separate step
This requires type information for each optic in the composition
These kinds of cases are usually produced when composing two functions that were already separately optimised (for caching purposes)
This comes at a slight cost in datafixer optimisation time, though it's entirely insignificant enough to be a concern and we end up with a more optimised function at the end. 🎉
An example before and after for the chunk datafixer from v100.
We noticed a few cases while reviewing #72 where the optimised fixer functions could be further reduced. This PR makes a few changes:
Fold
algebras and rewriting the internal functions, allowing compositions to be optimisedThis comes at a slight cost in datafixer optimisation time, though it's entirely insignificant enough to be a concern and we end up with a more optimised function at the end. 🎉
An example before and after for the chunk datafixer from v100.