From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 998F87EE77 for ; Wed, 23 Mar 2016 18:05:52 +0100 (CET) IronPort-PHdr: 9a23:X9TxhBYUIbFHn8GR34PHI0j/LSx+4OfEezUN459isYplN5qZpM2zbnLW6fgltlLVR4KTs6sC0LqG9fm+Ej1Zqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7D0osOYMlwArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIZoGJ/3dKUgTLFeEC9ucyVsvJWq5i/4UBCX63AAfmITmxtOS0iZvVCpFqv25wXgv+x23yiBdef7V70yVjm4p/NlUhbugyAGLHgz/XvajMN9lopapgigrlpx2diHTpuSMa9Yf6jaedoBDU1DU8pYHwZIGMvoaYoECO4IJqBfrYTxrh0EpAGWAQS8Be3ujDRPgymljuUBz+09HFSej0QbFNUUvSGR8Yz4 Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=nicolas.ojeda.bar@lexifi.com; spf=None smtp.mailfrom=nicolas.ojeda.bar@lexifi.com; spf=None smtp.helo=postmaster@mx30.yaziba.net Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of nicolas.ojeda.bar@lexifi.com) identity=pra; client-ip=82.138.71.21; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="nicolas.ojeda.bar@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of nicolas.ojeda.bar@lexifi.com) identity=mailfrom; client-ip=82.138.71.21; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="nicolas.ojeda.bar@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mx30.yaziba.net) identity=helo; client-ip=82.138.71.21; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="postmaster@mx30.yaziba.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DKAQAbzPJWkxVHilJehAZ6AQWqFotdhmwhhWwCgTYHPBABAQEBAQEBARABAQEBCQsJCSEvgi2CFQEBAwESEUsLBQsLBAcaHQICIhIBBQEKEgYTEhCHcAMKCAQKom+BMT4xizaLfgOEagEBAQEGAQEBAQEBGopihGmCU4JWBYYhDJEthXGIE4FmTYN/iFiNSREegQ0CDyiCPxyBNmmKCwEBAQ X-IPAS-Result: A0DKAQAbzPJWkxVHilJehAZ6AQWqFotdhmwhhWwCgTYHPBABAQEBAQEBARABAQEBCQsJCSEvgi2CFQEBAwESEUsLBQsLBAcaHQICIhIBBQEKEgYTEhCHcAMKCAQKom+BMT4xizaLfgOEagEBAQEGAQEBAQEBGopihGmCU4JWBYYhDJEthXGIE4FmTYN/iFiNSREegQ0CDyiCPxyBNmmKCwEBAQ X-IronPort-AV: E=Sophos;i="5.24,383,1454972400"; d="scan'208,217";a="170440420" Received: from mx30.yaziba.net ([82.138.71.21]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 23 Mar 2016 18:05:51 +0100 Received: from mta20.int.yaziba.net (unknown [217.117.151.14]) by mx30.yaziba.net (mx10.yaziba.net) with ESMTP id 6A1F81A770D; Wed, 23 Mar 2016 18:05:50 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mta20.int.yaziba.net (Postfix) with ESMTP id 69751CA67D; Wed, 23 Mar 2016 18:05:50 +0100 (CET) X-Virus-Scanned: amavisd-new at mta20.int.yaziba.net Received: from mta20.int.yaziba.net ([127.0.0.1]) by localhost (mta20.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1MUXL8uuzLlu; Wed, 23 Mar 2016 18:05:50 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mta20.int.yaziba.net (Postfix) with ESMTP id 3205BCA65B; Wed, 23 Mar 2016 18:05:50 +0100 (CET) X-Virus-Scanned: amavisd-new at mta20.int.yaziba.net Received: from mta20.int.yaziba.net ([127.0.0.1]) by localhost (mta20.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id j3jhdwxvfDfD; Wed, 23 Mar 2016 18:05:50 +0100 (CET) Received: from mail-vk0-f41.google.com (mail-vk0-f41.google.com [209.85.213.41]) by mta20.int.yaziba.net (Postfix) with ESMTPSA id 5E951CA67B; Wed, 23 Mar 2016 18:05:49 +0100 (CET) Received: by mail-vk0-f41.google.com with SMTP id e6so27431295vkh.2; Wed, 23 Mar 2016 10:05:48 -0700 (PDT) X-Gm-Message-State: AD7BkJJnQur5XzubFUcIYRMDSaUNuGUqdhSuJhH5yuDs+MOAuCpux3h1LNwVo75Aa6xF46YqL7+XlGfhKe3t2Q== X-Received: by 10.31.167.75 with SMTP id q72mr2213226vke.71.1458752746752; Wed, 23 Mar 2016 10:05:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.66.3 with HTTP; Wed, 23 Mar 2016 10:05:27 -0700 (PDT) In-Reply-To: <56F2C6D7.3080707@inria.fr> References: <56F2C6D7.3080707@inria.fr> From: Nicolas Ojeda Bar Date: Wed, 23 Mar 2016 18:05:27 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Francois Berenger Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=001a1142768e491381052eba5798 X-DRWEB-SCAN: ok X-VRSPAM-SCORE: -51 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrfeekkedrudeigdeljecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpjgetkgfkueetnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenogfuuhhsphgvtghtffhomhgrihhnucdlgeelmdenucfjughrpegjfhfhfffkuffvtgesrgdtreertddtjeenucfhrhhomheppfhitgholhgrshcuqfhjvggurgcuuegrrhcuoehnihgtohhlrghsrdhojhgvuggrrdgsrghrsehlvgigihhfihdrtghomheqnecuffhomhgrihhnpehfohhordhmlhdpihhnrhhirgdrfhhrpdhgihhthhhusgdrtghomhdphigrhhhoohdrtghomhenucfkphepvddtledrkeehrddvudefrdegudenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht Subject: Re: [Caml-list] Is it possible to get back some OCaml code after ppx processing ? --001a1142768e491381052eba5798 Content-Type: text/plain; charset=UTF-8 Hi Francois, You can use ppx_tools (https://github.com/alainfrisch/ppx_tools) to do it: ocamlfind ppx_tools/rewriter ./my_ppx_rewriter foo.ml Cheers, Nicolas On Wed, Mar 23, 2016 at 5:39 PM, Francois Berenger < francois.berenger@inria.fr> wrote: > Dear list, > > I am completely new to the -ppx option of the compiler, so please > forgive in advance my (probably stupid) two questions. > > Here is some example code: > --- > type t = { > i: int; > f: float > } [@@deriving sexp] > --- > > 1) I'd like to see all the functions automatically created > by the magical spell "[@@deriving sexp]". > At least their names and type signatures would be nice. > How to do that? > > 2) If that's not possible, I'd like to get back some > OCaml code corresponding to the AST after ppx processing. > If that's possible, how to do that? > > Thanks a lot, > Francois. > > -- > 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 > --001a1142768e491381052eba5798 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Francois,

You can use ppx_tools (https://github.com/alainf= risch/ppx_tools) to do it:

=C2=A0 ocamlfind ppx_tools/rewriter= ./my_ppx_rewriter foo.ml

= Cheers,
Nicolas


On Wed, Mar 23, 2016 at 5:39 PM, Francoi= s Berenger <francois.berenger@inria.fr> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">Dear list,

I am completely new to the -ppx option of the compiler, so please
forgive in advance my (probably stupid) two questions.

Here is some example code:
---
type t =3D {
=C2=A0 i: int;
=C2=A0 f: float
} [@@deriving sexp]
---

1) I'd like to see all the functions automatically created
by the magical spell "[@@deriving sexp]".
At least their names and type signatures would be nice.
How to do that?

2) If that's not possible, I'd like to get back some
OCaml code corresponding to the AST after ppx processing.
If that's possible, how to do that?

Thanks a lot,
Francois.

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

--001a1142768e491381052eba5798--