* [Caml-list] Porting old-style ppx to driver-style?
@ 2018-05-04 22:20 Paul A. Steckler
2018-05-10 7:00 ` Rudi Grinberg
0 siblings, 1 reply; 3+ messages in thread
From: Paul A. Steckler @ 2018-05-04 22:20 UTC (permalink / raw)
To: Ocaml Mailing List
There's a nice OCaml library, available via OPAM as "lens", which
allows deriving lenses for record types.
By adding the following clause in a jbuild file, the ppx works fine:
(preprocess (action (run ppxfind -legacy
lens.ppx_deriving,ppx_deriving.std --as-pp ${<})))
But adding "ppx_inline_test" to this clause doesn't allow an
"(inline_tests)" clause to work, and when building a library, only one
"preprocess" clause appears to have an effect.
Using the ppx within a "(preprocess (pps ...))" clause does not
succeed. So I can have lenses, or inline tests, but not both.
I believe the solution is to turn the ppx into a new-style "driver".
What's the best way to do that? Is it as simple as changing the build
to use a jbuild as described in the section "Creating a new Ppx_driver
based rewriter"?:
https://github.com/janestreet/ppx_driver
Do I need to make any other code changes?
-- Paul
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Porting old-style ppx to driver-style?
2018-05-04 22:20 [Caml-list] Porting old-style ppx to driver-style? Paul A. Steckler
@ 2018-05-10 7:00 ` Rudi Grinberg
2018-05-11 1:18 ` Paul A. Steckler
0 siblings, 1 reply; 3+ messages in thread
From: Rudi Grinberg @ 2018-05-10 7:00 UTC (permalink / raw)
To: Paul A. Steckler, Ocaml Mailing List
Hi Paul,
> I believe the solution is to turn the ppx into a new-style "driver".
> What's the best way to do that? Is it as simple as changing the build
> to use a jbuild as described in the section "Creating a new Ppx_driver
> based rewriter"?:
Using ppx_driver (now a part of ppxlib I believe) isn't necessary. I
think it should be enough to follow the lead of other ppx_deriving
plugins that are built with dune (ppx_deriving_yojson for example). The
necessary bit here is to use omp and generate a correct META file that
will make ppx_deriving_lens usable in driver *and* as a dynlinked
deriver for ppx_deriving itself.
There's an existing PR to port ocaml-lens and I believe it's on the
right track:
https://github.com/pdonadeo/ocaml-lens/pull/9
Perhaps you can help out with that effort?
Cheers,
Rudi.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Porting old-style ppx to driver-style?
2018-05-10 7:00 ` Rudi Grinberg
@ 2018-05-11 1:18 ` Paul A. Steckler
0 siblings, 0 replies; 3+ messages in thread
From: Paul A. Steckler @ 2018-05-11 1:18 UTC (permalink / raw)
To: Rudi Grinberg; +Cc: Ocaml Mailing List
On Thu, May 10, 2018 at 3:00 AM, Rudi Grinberg <rudi.grinberg@gmail.com> wrote:
> There's an existing PR to port ocaml-lens and I believe it's on the
> right track:
>
> https://github.com/pdonadeo/ocaml-lens/pull/9
>
> Perhaps you can help out with that effort?
In fact, I'm using that code (and my colleague submitted it).
Thanks for the clarification.
-- Paul
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-11 1:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04 22:20 [Caml-list] Porting old-style ppx to driver-style? Paul A. Steckler
2018-05-10 7:00 ` Rudi Grinberg
2018-05-11 1:18 ` Paul A. Steckler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox