From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 5DE807F62A for ; Wed, 11 May 2016 20:30:38 +0200 (CEST) IronPort-PHdr: 9a23:7N64rR+eiB1Xiv9uRHKM819IXTAuvvDOBiVQ1KB91ukcTK2v8tzYMVDF4r011RmSDdSdsqwP0rOL+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuSt+U1pr8jrnvs7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cY6Lod8JtLWKD+OqA5VqBwDTI8Mmlz6te4mwPESF6t4X0VTmUflFJkAizC9hz8TJC55in9sONh2CCce8H3SbcuVDKw6I9kTRbpjGEMMDtvozKfsdB5kK8O+EHpnBd42YOBOIw= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonathan.dilorenzo@gmail.com; spf=Pass smtp.mailfrom=jonathan.dilorenzo@gmail.com; spf=None smtp.helo=postmaster@mail-ig0-f176.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jonathan.dilorenzo@gmail.com) identity=pra; client-ip=209.85.213.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jonathan.dilorenzo@gmail.com"; x-sender="jonathan.dilorenzo@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jonathan.dilorenzo@gmail.com designates 209.85.213.176 as permitted sender) identity=mailfrom; client-ip=209.85.213.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jonathan.dilorenzo@gmail.com"; x-sender="jonathan.dilorenzo@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ig0-f176.google.com) identity=helo; client-ip=209.85.213.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jonathan.dilorenzo@gmail.com"; x-sender="postmaster@mail-ig0-f176.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CFAABDeTNXj7DVVdFeg1Y3fQamYgQDhzaLCwENgXYahzIHOBQBAQEBAQEBAREBAQEBBwsLCSEvgi2CDCIRHQEbHgMSCAEHNwIkAREBBQFXh3IBAxeaJIIHgTE+MYs7gWqCWIcsChknDVKDdQEFCgWGEYlXgjSCWQWNX4VRhHeFfogggjeMYo4DEh6BDh4BAYF4DFSBcSAyiQoBAQE X-IPAS-Result: A0CFAABDeTNXj7DVVdFeg1Y3fQamYgQDhzaLCwENgXYahzIHOBQBAQEBAQEBAREBAQEBBwsLCSEvgi2CDCIRHQEbHgMSCAEHNwIkAREBBQFXh3IBAxeaJIIHgTE+MYs7gWqCWIcsChknDVKDdQEFCgWGEYlXgjSCWQWNX4VRhHeFfogggjeMYo4DEh6BDh4BAYF4DFSBcSAyiQoBAQE X-IronPort-AV: E=Sophos;i="5.24,608,1454972400"; d="scan'208,217";a="217895619" Received: from mail-ig0-f176.google.com ([209.85.213.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 11 May 2016 20:30:37 +0200 Received: by mail-ig0-f176.google.com with SMTP id s8so38983828ign.0 for ; Wed, 11 May 2016 11:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=k4cdv0koMLo3xVsNympqn2t2gGDbtwIYOWxvKmGeyvY=; b=vpg9i6EyaawykkjNsoqFTEof51v2E/rtyErtXgMLmluL03Fn/wfiTemd3WgRl8sxwi 5LoOFKs4mPZQBC3Yw+HacVJ2ynpzYsMcr8+FBfKVhTGSq16jgiR0n8lh7AMv/FlTeLkJ r17sN+Tf1iiGtUfRlo+xrN8AaGcyv7VU7daI6iyjc0h+FPG+EXrFI4GT5gDR9sfxlGzl v1dWFQsfkkmVQHmDjhtuWDCr/UK/cLQC7c4VRRFOnKQ7beDdmFf61Ong1PQbGLjMVM/s DNh4d05c7+EyCwpapLTDgmUPZ+SWOcEDZCziZKkjx9f0YPPgDpxPtg9oQWu1RC7bu6Mw Uobg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=k4cdv0koMLo3xVsNympqn2t2gGDbtwIYOWxvKmGeyvY=; b=LbKzUDLCfbDY77qfyfmN4oGQbXlEcHV2Nr+xksfuJueNORI1wXW9dKDhUOhgTVjfRl 2Y6th9aobQgqQ4g852KXP1tcvpYR9E0/6H13xnyRTFFpWgdM0U6D3RVtgesz/1nhWYXI UJW8t1kSC3UXkDWNe9JAf9P/r35sJvON5meC8SE3l2lHNMcQWtMT/+UfS3MnkT6U84lw o5st5RR0iHyVJkQmsc++HORut2OIF9zu4cWZmrP5n97+bNl7MgBzEnjgjkSmPs24fz6+ D2jEy/nOquwLg4VO2Sfk/Bna235DaO81MHZ+XrKnWCU9qoO+WVr++jjRUuNEG9z9MwnA WnBg== X-Gm-Message-State: AOPr4FWBFeZ31haVXgioJWtRr6UjlZdcAKAlOdKVybTYr5IkbaO4IWQ4FxWPwJFja9yld7UkIwSgT6uxwIgkyA== X-Received: by 10.50.111.72 with SMTP id ig8mr24084639igb.35.1462991436390; Wed, 11 May 2016 11:30:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.69.147 with HTTP; Wed, 11 May 2016 11:30:17 -0700 (PDT) From: Jonathan DiLorenzo Date: Wed, 11 May 2016 14:30:17 -0400 Message-ID: To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=089e013a2b54e04f730532953c11 Subject: [Caml-list] PPX metaquotation question --089e013a2b54e04f730532953c11 Content-Type: text/plain; charset=UTF-8 Hey all! I'm trying to construct a type declaration structure item using the metaquotation in ppx_tools and I have two variables containing a string with the name of the type and a Parsetree.core_type, like so: let name = "some_type" in let typ = [%type: string] in [%stri type [%??? name] = [%t typ] ] Is there a ??? that lets me do this? Am I going about it all wrong somehow? Or do I need to do something like: open Ast_helper let name = "some_type" in let typ = [%type: string] in let type_decl = Type.mk ~manifest:typ { txt=name ; loc = !default_loc} in Str.type_ Recursive [type_decl] Best, Jonathan --089e013a2b54e04f730532953c11 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hey all!

I'm trying to construct a = type declaration structure item using the metaquotation in ppx_tools and I = have two variables containing a string with the name of the type and a Pars= etree.core_type, like so:

let name =3D "some_= type" in
let typ =3D [%type: string] in
[%stri typ= e [%??? name] =3D [%t typ] ]

Is there a ??? that l= ets me do this? Am I going about it all wrong somehow? Or do I need to do s= omething like:

open Ast_helper

let name =3D "some_type" in
let typ =3D [%type: s= tring] in
let type_decl =3D Type.mk ~manifest:typ { txt=3Dname ; = loc =3D !default_loc} in
Str.type_ =C2=A0Recursive [type_decl]

Best,
Jonathan
--089e013a2b54e04f730532953c11--