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

Remove ppx generators #342

Merged
merged 8 commits into from
May 15, 2023
Merged

Remove ppx generators #342

merged 8 commits into from
May 15, 2023

Conversation

shym
Copy link
Collaborator

@shym shym commented May 11, 2023

This PR removes the ppx derivers for show, eq and qcheck.

Open questions:

  • should we remove also derivers in doc/?
  • should we use (=) instead of those equal_ functions?
  • we could improve the pretty-printers to get closer to standard OCaml printers and/or to the derived ones (opening boxes, etc.) The code is structured so that this should be easy to do.

Closes #341.

Copy link
Collaborator

@jmid jmid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One word: Awesome! 😄 🎉

should we remove also derivers in doc/?

I actually thought the examples were run in the CI - but I realize now that they are not.
Based on the above, I was thinking of using ppx_deriving in the text (to keep it short) but including a commented show etc in the code

 (* Note: you can omit the following definition if you uncomment 
      (preprocess (pps ppx_deriving.show))
    in the dune file *)`

Since we don't run the examples, I think it is fine to leave it as is though.

should we use (=) instead of those equal_ functions?

Polymorphic equality would certainly make things a bit shorter, but there are also arguments against using it entirely. I think what you have done is very reasonable 👍

we could improve the pretty-printers to get closer to standard OCaml printers and/or to the derived ones (opening boxes, etc.) The code is structured so that this should be easy to do.

That would be nice to have(TM) but not strictly needed ATM.

I also realize our expect outputs were already a bit inconsistent in we would print
(Remove -605797133) : Some (-605797133) which is now
Remove -605797133 : Some (-605797133) - where we have a constructor with a negative int argument on either side of the colon.

This is just me getting distracted and doesn't mean anything for the PR.
A CHANGES entry to announce the new Util sub-modules Pp and Equal would perhaps be in order...

shym added 8 commits May 12, 2023 11:12
Add a sh+awk script to help write the boilerplate code instead of
relying on ppxlib-based derivers
Add Util submodules to define pretty-printers and equality testers
Generate all code once and for all, hand-tuning the boilerplate code
generated by helper scripts
@shym
Copy link
Collaborator Author

shym commented May 12, 2023

I actually thought the examples were run in the CI - but I realize now that they are not.

I thought so too, I expected them to be run at least in the documentation workflow, but I don’t think they are. Anyway, keeping the ppxlib dependency for examples that are run on current stable didn’t feel such a big deal.

Since we don't run the examples, I think it is fine to leave it as is though.

👍

I also realize our expect outputs were already a bit inconsistent in we would print (Remove -605797133) : Some (-605797133) which is now Remove -605797133 : Some (-605797133) - where we have a constructor with a negative int argument on either side of the colon.

Well-spotted! The pretty-printers for numbers should be fixed now, and use parentheses when required for negative values.

A CHANGES entry to announce the new Util sub-modules Pp and Equal would perhaps be in order...

I added that.

Along those fixes, I also dropped the use of optional argument, as it was more cumbersome than I had hoped. The few cases where it allowed the implicit uses of the optional value were making it annoying when you define functions that must have that optional argument but they will ignore it (it is the case of pretty-printers for sum types when no constructor has an argument, for instance).

I also added documentation to the Util.Pp module, since it is exposed and is useful to users of the library.

@jmid
Copy link
Collaborator

jmid commented May 12, 2023

Still LGTM 😃👍
➕ for removing the optional parameters.
It is also my experience from QCheck, that they don't always work well together with combinators.

@jmid
Copy link
Collaborator

jmid commented May 15, 2023

CI summary:

  • Windows 5.1 failed to trigger the Out_channel issue
  • Windows bytecode trunk triggered the threadomain lock issue [ocaml5-issue] Windows failures on threadomain #203
  • Cygwin trunk, part2 timeout, due to excessive Lin DSL Weak HashSet test with Domain shrinking

None of these are related to the PR, so I'll merge 👍

@jmid jmid merged commit 1af3bd0 into ocaml-multicore:main May 15, 2023
@jmid jmid mentioned this pull request May 15, 2023
jmid added a commit that referenced this pull request May 15, 2023
Avoid using Seq.equal which was added in 4.14.
Initially fixed in #340 and then broken in #342.

Co-authored-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
Co-authored-by: Edwin Török <edwin.torok@cloud.com>
jmid added a commit that referenced this pull request May 15, 2023
Avoid using Seq.equal which was added in 4.14.
Initially fixed in #340 and then broken in #342.

Co-authored-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
Co-authored-by: Edwin Török <edwin.torok@cloud.com>
@shym shym deleted the drop-ppxlib branch June 12, 2023 09:20
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.

Eliminate the ppxlib dependency
2 participants