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 962247EE36 for ; Thu, 24 Mar 2016 11:38:09 +0100 (CET) IronPort-PHdr: 9a23:XtErKBw0BffirATXCy+O+j09IxM/srCxBDY+r6Qd0eIVIJqq85mqBkHD//Il1AaPBtWLrasUwLOM+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuSt6U1pT8jrr60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGxmgO8678NLTYn9eq05S/QYUGVnYCgJ45jEsgLcTA3H+HwaGk8MnxZFGQzC81muUZDqrSr88/Q40gGFMMewQb1iChq46KI+ahLyhSIGOnYV8WTWjMs42KBXoRegoRtXwYfSbZqJLvdzYuXWetZMFjkJZdpYSyEUWtD0VIAIFedUYbdV Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jdimino@janestreet.com; spf=Pass smtp.mailfrom=jdimino@janestreet.com; spf=None smtp.helo=postmaster@mxout1.mail.janestreet.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jdimino@janestreet.com) identity=pra; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jdimino@janestreet.com designates 38.105.200.112 as permitted sender) identity=mailfrom; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mxout1.mail.janestreet.com) identity=helo; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="postmaster@mxout1.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BTAQAow/NWjnDIaSZehAZ9Bql/kkkhhWwCgS0HPBABAQEBAQEBARABAQEBBxYJUIItghQBAQEDARIRBBkBASwLAQQLCQILDQ0dAgIiEgEFAQoSBhMSEIdwAwoIAwuTEY9BgTE+MYpPZ4RBAQSHGAMfhGUBAQEBAQEBAwEBAQEBAQEBAQEBDwYKhhSERIRpglOCVoYmDJExhXGIE4FmTYN/iFmNSxEegQ8PKIIhChQIFIE1bIlUAQEB X-IPAS-Result: A0BTAQAow/NWjnDIaSZehAZ9Bql/kkkhhWwCgS0HPBABAQEBAQEBARABAQEBBxYJUIItghQBAQEDARIRBBkBASwLAQQLCQILDQ0dAgIiEgEFAQoSBhMSEIdwAwoIAwuTEY9BgTE+MYpPZ4RBAQSHGAMfhGUBAQEBAQEBAwEBAQEBAQEBAQEBDwYKhhSERIRpglOCVoYmDJExhXGIE4FmTYN/iFmNSxEegQ8PKIIhChQIFIE1bIlUAQEB X-IronPort-AV: E=Sophos;i="5.24,384,1454972400"; d="scan'208,217";a="170579252" Received: from mxout1.mail.janestreet.com ([38.105.200.112]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Mar 2016 11:37:43 +0100 Received: from tot-qpr-mailcore1.delacy.com ([172.27.56.68] helo=tot-qpr-mailcore1) by mxout1.mail.janestreet.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1aj2e5-0002s7-LK for caml-list@inria.fr; Thu, 24 Mar 2016 06:37:41 -0400 X-JS-Flow: external Received: by tot-qpr-mailcore1 with JS-mailcore (0.1) (envelope-from ) id BW88N1-AAACnV-TO; 2016-03-24 06:37:41.616380-04:00 Received: from mail-io0-f174.google.com ([209.85.223.174]) by mxgoog2.mail.janestreet.com with esmtps (UNKNOWN:AES128-GCM-SHA256:128) (Exim 4.72) (envelope-from ) id 1aj2e5-00032l-EX for caml-list@inria.fr; Thu, 24 Mar 2016 06:37:41 -0400 Received: by mail-io0-f174.google.com with SMTP id m184so80522893iof.1 for ; Thu, 24 Mar 2016 03:37:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=mGxrN4J8fxUomamG/jH44woRTe06Qnp7necZOBIhTEc=; b=ZEbe4FYoPOGqaJzLY47k5CxKYErcDWyLp8DeQuKFbLojVQW8RsvVezbjQGLlrHwjZ6 aZPSNwJCcVKpoSLF1BaukVHPGRPQTMU44Imo+9dBah6vzpnwD6ofrrW+yphT8rzAmopS k4k4t+ro3IcphmuSdVCKj8jnNGDWj8S7FAV70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=mGxrN4J8fxUomamG/jH44woRTe06Qnp7necZOBIhTEc=; b=RsaF5zQjcmwYCXIGdsYlFoFdc7kMpV3WqwvW/Ai1NpnZnpRFYGV5q4Arewxf0mqf/2 +8h7Tb5nyALdWJU+bong7AAcoVQJ6B8JR9azVMpc9EmeYLnut1v/flBLMzIE5q3UgU4O 1HKJMwGFQ5ggXhcGMC31JwaZMkH+aBrSjnksS8X/rEuarBtRp0DMVD8KIhXCNc/1hLT4 AEvGnjM4xWN0fQqoUVv1nOrCyNgvnNUhXjm3bY+TwUGFWxpBIKQ5IxkEFIMdUTPsj5ef SDx9I8OJC92LUjw7v1gyITaEYZP2KA4pTmb5XRVqDzxwFUVuIMarPToSnk1xdEudPGMm KIsA== X-Gm-Message-State: AD7BkJJqdT6SDVDo7t2oIzuNABBlTOzHsMRWisH++/2+BRp0ibiKWSBeln9rziEh9qHLSwiDftsV899rtJYFlbMxAShIVhIdkAG38J/Ie0hzs10FKUH3kW8GCLdMePCC8iCRk57wMjbLOM0oUoJx X-Received: by 10.107.138.20 with SMTP id m20mr8749045iod.82.1458815861050; Thu, 24 Mar 2016 03:37:41 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.107.138.20 with SMTP id m20mr8749038iod.82.1458815860921; Thu, 24 Mar 2016 03:37:40 -0700 (PDT) Received: by 10.50.30.193 with HTTP; Thu, 24 Mar 2016 03:37:40 -0700 (PDT) In-Reply-To: <20160324092714.GA32689@frosties> References: <56F2C6D7.3080707@inria.fr> <20160324092714.GA32689@frosties> Date: Thu, 24 Mar 2016 10:37:40 +0000 Message-ID: From:Jeremie Dimino To:Goswin von Brederlow Cc:"caml-list@inria.fr" Content-Type: multipart/alternative; boundary=001a113fd3782f1189052ec909b1 X-JS-Processed-by: mailcore Subject: Re: [Caml-list] Is it possible to get back some OCaml code after ppx processing ? --001a113fd3782f1189052ec909b1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable For the case of Jane Street ppx rewriters (assuming you are using ppx_sexp_conv), you can install ppx_jane and do: ppx-jane file.ml On Thu, Mar 24, 2016 at 9:27 AM, Goswin von Brederlow wrote: > On Wed, Mar 23, 2016 at 06:02:49PM +0100, Louis Roch=C3=A9 wrote: > > Hi, > > > > 1) With utop, you will get what you want: > > > > utop # type t =3D { > > i: int; > > f: float > > } [@@deriving eq,show];; > > type t =3D { i : int; f : float; } > > val equal : t -> t -> bool =3D > > val pp : Format.formatter -> t -> unit =3D > > val show : t -> bytes =3D > > > > 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 =3D { > > > 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. > > 'ocamlc -i' should work too. > > MfG > Goswin > > -- > 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 > --=20 Jeremie --001a113fd3782f1189052ec909b1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
For the case of Jane Street ppx rewriters (assuming you= are using ppx_sexp_conv), you can install ppx_jane and do:

=C2=A0 ppx-jane file.ml

On Thu, Mar 24, 2016= at 9:27 AM, Goswin von Brederlow <goswin-v-b@web.de> wrote:=
= On Wed, Mar 23, 2016 at 06:02:49PM +0100, Louis Roch=C3=A9 wrote:
> Hi,
>
> 1) With utop, you will get what you want:
>
> utop # type t =3D {
>=C2=A0 =C2=A0i: int;
>=C2=A0 =C2=A0f: float
> } [@@deriving eq,show];;
> type t =3D { i : int; f : float; }
> val equal : t -> t -> bool =3D <fun>
> val pp : Format.formatter -> t -> unit =3D <fun>
> val show : t -> bytes =3D <fun>
>
> 2) I believe that you are looking for an option like -dsource for ocam= lc
>
> 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 =C2=A0i: int;
> >=C2=A0 =C2=A0f: 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.

'ocamlc -i' should work too.

MfG
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = Goswin

--
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



--
=
Jeremie
--001a113fd3782f1189052ec909b1--