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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 2E95D7EE35 for ; Wed, 23 Mar 2016 18:03:10 +0100 (CET) IronPort-PHdr: 9a23:xToF6xdOgUOsZZMBA7dmH5cdlGMj4u6mDksu8pMizoh2WeGdxc+6YR7h7PlgxGXEQZ/co6odzbGG4+a5BydRuN6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDivcSNKFQRzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IeezAcq85Vb1VCig9eyBwvZWz9Er1dhaU/nYXTkkRlxNJBUCFsEC7Dd/NtX7UrON70y6bJoXcQKo5Xzuv9e8/RgXhjiwANiV/+mzNh8p/gbhzoRS7phU5zZSCM6+PM/8rWqTAfMhSf21KXkcZAyhGH4KnR48IEusaJ+FTr4S7oVYS+0jtTTKwDf/in2cbzkT92rc3hqF8SAw= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mail@louisroche.net; spf=None smtp.mailfrom=mail@louisroche.net; spf=None smtp.helo=postmaster@mail-lb0-f194.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mail@louisroche.net) identity=pra; client-ip=209.85.217.194; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mail@louisroche.net"; x-sender="mail@louisroche.net"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mail@louisroche.net) identity=mailfrom; client-ip=209.85.217.194; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mail@louisroche.net"; x-sender="mail@louisroche.net"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-lb0-f194.google.com) identity=helo; client-ip=209.85.217.194; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mail@louisroche.net"; x-sender="postmaster@mail-lb0-f194.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CSAgBPy/JWi8LZVdFehAZ6BqoWkmqFbIE4BzwQAQEBAQEBAQEQAQEBCAsLCR8xQQ4BgV2CFQEBAwESEQQZAQEsCwEECwEKBAcaHQICIhIBBQEKEgYTEhCHcAMKCAQKomyBMT4xik9nhEEBBIc4A4RqAQEIAQEBARYGCoUchTyEaYJTglaGJgyRLYVxiBOBZk2Df4hYjUkRHoEPDyiCIQocFIE2aQGELYRfAX0BAQE X-IPAS-Result: A0CSAgBPy/JWi8LZVdFehAZ6BqoWkmqFbIE4BzwQAQEBAQEBAQEQAQEBCAsLCR8xQQ4BgV2CFQEBAwESEQQZAQEsCwEECwEKBAcaHQICIhIBBQEKEgYTEhCHcAMKCAQKomyBMT4xik9nhEEBBIc4A4RqAQEIAQEBARYGCoUchTyEaYJTglaGJgyRLYVxiBOBZk2Df4hYjUkRHoEPDyiCIQocFIE2aQGELYRfAX0BAQE X-IronPort-AV: E=Sophos;i="5.24,383,1454972400"; d="scan'208,217";a="209768600" Received: from mail-lb0-f194.google.com ([209.85.217.194]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 23 Mar 2016 18:03:09 +0100 Received: by mail-lb0-f194.google.com with SMTP id sx8so1462899lbb.3 for ; Wed, 23 Mar 2016 10:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=louisroche-net.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ysLLneA+2YCZawUsncNQz2Zgdnnt4umVyHISHSSSUGA=; b=kGSchV+DCndmpciQ5pS55dgcx2ae78nnindn1azkasmZPL8WyXgEn323NvKecDIVck 6O9dJBe1gbeLcNqR/qmSgCWy7YXkd/5EAU4tz/92VND2+hEJ+KsfpJtkcy0P3jlOI6w9 tXDDJ8uWGLlizEihQLk0Mrybrv1dmI6pqgdkiVyDcPrB3dvcexovaHvXNm3OiT54vcgu V+rOVpnVUCFf5oXSnXW2kn3WvZgEfHv2pinlklpV7khfinRj2kqiz3bMSyrlWj/C7sWc Iz+EnpZddvBt3PVrce2lgPwdokEKfaMv9sSoeM9WeLfp4a0tNp6Tj4JTRFH7EgHo3h4K nGTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ysLLneA+2YCZawUsncNQz2Zgdnnt4umVyHISHSSSUGA=; b=mcxnLverTjtoC9z1T0oE0ETWH/jZtlg3sHS4SYgjFXCCWyWaqHmK2g6TRPsN2P1cOl oYftpxAxctOUCcL/8+ZjLoiN0nOs0cQ1Sjd3UgiV6sjzKMpjv+KiycoIi6oOpZE+6CWB +MqUWhTfcK7pDIOkkFEbzKobi6RDQ12cHVGsOEKStQqGwUIehDreHLUpaUIYLYkAuLxQ t3/KMuCBPuq9O2WftHy/IEL6iKqfWiqw71LnnHnU4z4MXjkVab/PdEnOIkUdD1KQklVy RHHJoCMwTURzuM3sOJy9FcH3lbPLRXHAioJkz8U9F6VfzeXV/msH6OgpT/NqBmlT8ZtM LtYw== X-Gm-Message-State: AD7BkJLbpWT4r49BGnt1p2rhOimLhByyitKgVs1uDmGbUzUlnOywSBLek3aMS7gZkj2M7RkkKVUC1kQKSDAk3A== X-Received: by 10.112.125.201 with SMTP id ms9mr1683862lbb.141.1458752588561; Wed, 23 Mar 2016 10:03:08 -0700 (PDT) MIME-Version: 1.0 Sender: mail@louisroche.net Received: by 10.25.213.212 with HTTP; Wed, 23 Mar 2016 10:02:49 -0700 (PDT) X-Originating-IP: [195.212.22.247] In-Reply-To: <56F2C6D7.3080707@inria.fr> References: <56F2C6D7.3080707@inria.fr> From: =?UTF-8?B?TG91aXMgUm9jaMOp?= Date: Wed, 23 Mar 2016 18:02:49 +0100 X-Google-Sender-Auth: VprGmdUgXzMfCbSWqraHaHzrmi4 Message-ID: To: Francois Berenger Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=089e0115f118db57d4052eba4dcd Subject: Re: [Caml-list] Is it possible to get back some OCaml code after ppx processing ? --089e0115f118db57d4052eba4dcd Content-Type: text/plain; charset=UTF-8 Hi, 1) With utop, you will get what you want: utop # type t = { i: int; f: float } [@@deriving eq,show];; type t = { i : int; f : float; } val equal : t -> t -> bool = val pp : Format.formatter -> t -> unit = val show : t -> bytes = 2) I believe that you are looking for an option like -dsource for ocamlc Louis 2016-03-23 17:39 GMT+01:00 Francois Berenger : > 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 > --089e0115f118db57d4052eba4dcd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

1) With utop, you will get= what you want:

utop # type t =3D {
=C2=A0 i: int;
=C2=A0 f: f= loat
} [@@deriving eq,show];;
type t =3D { i : int; f : float; }
v= al equal : t -> t -> bool =3D <fun>
val pp : Format.formatte= r -> t -> unit =3D <fun>
val show : t -> bytes =3D <fu= n>

2) I believe that you are looking for an option like -ds= ource for ocamlc

Louis


2016-03-23 17:39 GMT+= 01:00 Francois Berenger <francois.berenger@inria.fr>:
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

--089e0115f118db57d4052eba4dcd--