-
Notifications
You must be signed in to change notification settings - Fork 29
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
Dune / OMP support #26
Comments
Yes and yes. |
Great, thanks @whitequark ; IIUC, using OMP requires to choose a version to start with, I understand that |
Sure. |
I opted to use The main roadblock I'm facing for now is the lack of | Tarrow (label, lhs, rhs, _) ->
Typ.arrow label (core_type_of_type_expr ~subst lhs)
(core_type_of_type_expr ~subst rhs) Here, What strategy would you recommend folks ? Thanks! p.s: The tree I'm working on is at https://github.com/ejgallego/ppx_import/tree/dune%2Bomp compilation with dune works up to the point of seeing the above error. |
Right. I'm not actually sure this is easily solvable. |
There's not a lot of stuff to "migrate"; I could file a request to OMP so they support However I have 0 experience with ppx so I'd appreciate guidance from the far more experienced people around. |
The problem is that ppx_import depends on Untypeast... |
Sorry if my questions are naïve @whitequark , where is this dependency inserted? I can't seem to locate it. |
Another naïve question I have is whether we should target |
Hm, maybe not anymore. Really, I haven't worked with any of this in ages, @gasche would probably be in a much better position to answer. |
I think it should be possible to separate (conceptually) the aspects of ppx_import that rely on the parsetree, and those that rely on the typedtree. Then the parsetree stuff would be versioned, and the typedtree stuff I guess would remain version-pinned (or you motivate people to implement ocaml-migrate-typedtree indeed). The case you highlight is special in that a typedtree-world value, I would just consider that there are two Asttypes modules, and write conversion functions from one to the other. So write identity-looking functions from "the typedtree Asttypes" to "the parsetree Astty[pes". It's not a very big module, so it wouldn't be a lot of work. |
Well, the only place I can see is If we forget about the typedtree migration [which can be achieved by compiling the plugin in 4.06.1], the only bits to replace in order to get the rewrite to compiler are:
|
Yup, that looks like a good plan. However before we do this I'd like to get the rewriter working with 4.06.1 + |
@ejgallego |
Thanks @diml ! |
@diml while you are here (thanks!), how do |
They don't... In general, it's not clear how two ppx rewriters using the typer can be used together, so ppxlib doesn't try to support these. ppx_import is a particular case as it doesn't need to type the input. However, if you consider ppx rewriters such as ppx_show, it is not possible to use two of these on the same file. It seems to me that the current ppx model is not very friendly to rewriters using the typer. I thought about how it could be changed to make it easier to write ppx rewriters using the typer and especially compose them. It seems to me that given that most ppx rewriters only generate code locally, we could simply do the expansion in the typer: i.e. whenever the typer encounters a foreign syntax, such as an extension point or a type declaration with a Regarding the data types themselves and compatibility with multiple compiler versions, it seems to me that the most straightforward solution is to provide construction functions + view patterns. These can be versioned independently of the underlying data types. |
Ok, I got the rewriter compiling now, however tests fail with:
will investigate more later. |
Oops, that's a bug in dune. This PR should fix the issue: ocaml/dune#1218 |
Thanks again @diml ! |
Ok, so with the dune fix things seem to be working now with However, combining with
I do understand that this will be trickier to solve, right? |
Yh, it's an ordering problem: ppx_import is not applied soon enough. I'm preparing a patch for omp to allow specifying that a rewriter must be applied before other ones. |
I made the PR: ocaml-ppx/ocaml-migrate-parsetree#51 |
Thanks @diml . Another weird problem I'm hitting is that (library
(public_name coq-serapi.serlib)
(name serlib)
(synopsis "Serialization Library for Coq")
(preprocess (staged_pps ppx_import ppx_sexp_conv))
(libraries coq.stm sexplib)) But I do get:
|
Does that mean that |
Hmm, normally when |
|
Ah, I see the issue. We need a patch in ppxlib as well to not override the tool name. I'm looking at this. |
This PR for ppxlib should fix the issue: ocaml-ppx/ppxlib#41 |
I confirm that with the above PR The problem with |
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
@gasche a small note, I think that |
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` This is still work in progress, in particular, it only works with OCaml 4.06 due to the need to have `typedtree` versioning. This will need to be resolved before this PR can be merged. Another question is whether we should use `ppx_tools_versioned` or `ppxlib` directly.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Introduce migration functions for elements of `Asttypes` - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` We had to raise dependencies on quite a few packages, thus ppx_import only works now with OCaml >= 4.04.2. A couple of questions remain: - What to do with `Outcometree` [c.f: "Primitive.print p oval"] - Should we use ppx_tools_versioned or ppxlib directly?
Note that #27 , fixing this issue is basically ready for review, and maybe merge. |
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Introduce migration functions for elements of `Asttypes` - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` - Upgrade to OPAM 2.0 - Update Travis CI. We had to raise dependencies on quite a few packages, thus ppx_import now requires OCaml >= 4.04.2. The question of whether we should use `ppx_tools_versioned` or `ppxlib` does remain, but it can be addressed at a later point.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Introduce migration functions for elements of `Asttypes` - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` - Upgrade to OPAM 2.0 - Update Travis CI. We had to raise dependencies on quite a few packages, thus ppx_import now requires OCaml >= 4.04.2. The question of whether we should use `ppx_tools_versioned` or `ppxlib` does remain, but it can be addressed at a later point.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Introduce migration functions for elements of `Asttypes` - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` - Upgrade to OPAM 2.0 - Update Travis CI. We had to raise dependencies on quite a few packages, thus ppx_import now requires OCaml >= 4.04.2. The question of whether we should use `ppx_tools_versioned` or `ppxlib` does remain, but it can be addressed at a later point.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Introduce migration functions for elements of `Asttypes` - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` - Upgrade to OPAM 2.0 - Update Travis CI. We had to raise dependencies on quite a few packages, thus ppx_import now requires OCaml >= 4.04.2. The question of whether we should use `ppx_tools_versioned` or `ppxlib` does remain, but it can be addressed at a later point.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Introduce migration functions for elements of `Asttypes` - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` - Upgrade to OPAM 2.0 - Update Travis CI. We had to raise dependencies on quite a few packages, thus ppx_import now requires OCaml >= 4.04.2. The question of whether we should use `ppx_tools_versioned` or `ppxlib` does remain, but it can be addressed at a later point.
Fixes ocaml-ppx#26. Changes: - Build system migrated to Dune. - Remove use of `cppo` in favor of ocaml-migrate-parsetree - Introduce migration functions for elements of `Asttypes` - Remove use of `topkg` in favor of `dune-release` - Updated `.gitignore` - Upgrade to OPAM 2.0 - Update Travis CI. We had to raise dependencies on quite a few packages, thus ppx_import now requires OCaml >= 4.04.2. The question of whether we should use `ppx_tools_versioned` or `ppxlib` does remain, but it can be addressed at a later point.
CHANGES: 1.6 --- * ocaml-migrate-parsetree + dune support ocaml-ppx/ppx_import#26 (Jérémie Dimino & Emilio Jesús Gallego Arias) * Move to OPAM 2.0, adapt Travis CI. (Emilio Jesús Gallego Arias) 1.5 --- * OCaml 4.07 support ocaml-ppx/ppx_import#24 (Damien Doligez) * Call the type-checker (through compiler-libs) instead of reading `.cmi` files directly, to correctly resolve module aliases. ocaml-ppx/ppx_import#25 (Gabriel Scherer) 1.4 --- * OCaml 4.06 support ocaml-ppx/ppx_import#19 (Gabriel Scherer) 1.3 --- * Also allow extraction of module types from the current module's interface file. ocaml-ppx/ppx_import#12 (Xavier Guérin) 1.2 --- * Allow extracting types from the current module's interface file. (Xavier Guérin) 1.1 --- * OCaml 4.03 support. (whitequark) 1.0 --- * Allow extracting types from module types. (whitequark) 0.1 --- * Initial release. (whitequark)
CHANGES: * ocaml-migrate-parsetree + dune support ocaml-ppx/ppx_import#26 (Jérémie Dimino & Emilio Jesús Gallego Arias) * Move to OPAM 2.0, adapt Travis CI. (Emilio Jesús Gallego Arias)
CHANGES: * ocaml-migrate-parsetree + dune support ocaml-ppx/ppx_import#26 (Jérémie Dimino & Emilio Jesús Gallego Arias) * Move to OPAM 2.0, adapt Travis CI. (Emilio Jesús Gallego Arias)
CHANGES: * ocaml-migrate-parsetree + dune support ocaml-ppx/ppx_import#26 (Jérémie Dimino & Emilio Jesús Gallego Arias) * Move to OPAM 2.0, adapt Travis CI. (Emilio Jesús Gallego Arias)
Dear
ppx_import
devs, as noted in ocaml/dune#193 (comment) , Dune can supportppx_import
style rewriters now.However, some action would be needed on the
ppx_import
part. In particular, migrating it to useocaml-migrate-parsetree
, and maybe, even porting the build system to Dune (which IMVHO seems like a good idea).Do you think any of these goals are desirable? Would you welcome a patch?
The text was updated successfully, but these errors were encountered: