Add toplevel_printer support for functors #378
Closed
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.
This PR extends #269 by adding support for annotations with functors.
This issue was discovered while attempting to add pretty-printers for Irmin (mirage/irmin#1839).
I centralized the code for these annotations into a module named
Autoprinter
. It is a combination of code from a proof-of-concept created for this issue (https://github.com/let-def/autoprinter) and the existing code for automatically installing printers.I have tested this for each conditional compiler check in the code (4.04, 4.06, 4.08, 4.09, 4.10) using both the Irmin PR (when compatible) above and a simple test project (https://github.com/metanivek/pp_utop_testing). Additionally, I noticed that
ocp-indent
didn't format the code well, so I tried to match the existing indentation style.Feedback and comments welcome!