Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add toplevel_printer support for functors #378

Closed
wants to merge 1 commit into from

Conversation

metanivek
Copy link
Contributor

@metanivek metanivek commented Jun 6, 2022

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!

@rgrinberg
Copy link
Collaborator

Looking briefly at the code, it seems fine to me. I will test it as well.

Meanwhile, can you rebase and remove all the ifdefs for OCaml < 4.08. Support for older versions was recently dropped.

@metanivek
Copy link
Contributor Author

Thanks for the review. I've rebased and updated the ifdefs. I'm very happy to have fewer compiler checks in the code. 😄

@rgrinberg
Copy link
Collaborator

Merged. Thanks.

@rgrinberg rgrinberg closed this Jul 27, 2022
emillon added a commit to emillon/opam-repository that referenced this pull request Jan 5, 2023
CHANGES:

* Bump the compatibility to 4.08+ (ocaml-community/utop#393 @emillon)
* Load `@toplevel_printer` annotated printers for functors (ocaml-community/utop#378 @metavinek)
* Do not display a backtrace when exiting normally (ocaml-community/utop#399 ocaml-community/utop#398 @emillon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants