caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Paul A. Steckler" <steck@stecksoft.com>
To: Ocaml Mailing List <caml-list@inria.fr>
Subject: [Caml-list] Porting old-style ppx to driver-style?
Date: Fri, 4 May 2018 18:20:21 -0400	[thread overview]
Message-ID: <CAMSKV5fLxsTFyrR1naMSPk_Nb7kEd3dLeeD1eF8T3p7C6YKf7w@mail.gmail.com> (raw)

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

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

             reply	other threads:[~2018-05-04 22:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 22:20 Paul A. Steckler [this message]
2018-05-10  7:00 ` Rudi Grinberg
2018-05-11  1:18   ` Paul A. Steckler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMSKV5fLxsTFyrR1naMSPk_Nb7kEd3dLeeD1eF8T3p7C6YKf7w@mail.gmail.com \
    --to=steck@stecksoft.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).