Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] PPX metaquotation question
@ 2016-05-11 18:30 Jonathan DiLorenzo
  2016-05-12  7:10 ` Alain Frisch
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan DiLorenzo @ 2016-05-11 18:30 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 866 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-12  7:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 18:30 [Caml-list] PPX metaquotation question Jonathan DiLorenzo
2016-05-12  7:10 ` Alain Frisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox