-
Notifications
You must be signed in to change notification settings - Fork 5
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 comparison function for Pp.Ast.t #9
add comparison function for Pp.Ast.t #9
Conversation
src/pp.ml
Outdated
let compare_triple f g h (x, y, z) (a, b, c) = | ||
compare_both f (compare_both g h) (x, (y, z)) (a, (b, c)) | ||
|
||
let compare compare_tag = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can define it directly on Pp.t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't compare Format
so we can just use this together with to_ast
for Pp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. that's unnecessarily slow. Just raise if you get Format
. We should just get rid of that constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove Format
in another PR. I've made Pp.compare
which will raise Invalid_argument
if two Pp.of_fmt
values are provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, I made a mistake not listening to Jeremie here: #1
What I think we can do is introduce a Pp.Fmt
submodule that allows to inject this Format
constructor. The core Pp.t
should stay serializable, comparable, and all that good stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems sensible, but it is beyond the scope of what I am willing to do at the moment. We should definitely take another look at that in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, could you add a CHANGES entry?
f01591d
to
438153f
Compare
Signed-off-by: Ali Caglayan <[email protected]>
438153f
to
fee774d
Compare
@rgrinberg Added a CHANGES entry. (Before I also added a test). |
CHANGES: - Add `Pp.compare` (ocaml-dune/pp#9, @Alizter)
CHANGES: - Add `Pp.compare` (ocaml-dune/pp#9, @Alizter)
No description provided.