From: Joel Reymont <joelr1@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: Transforming of ASTs and polymorphic variants
Date: Wed, 25 Apr 2007 05:19:00 +0100 [thread overview]
Message-ID: <15893C08-FD0C-456B-A12F-DADCF6CC95F9@gmail.com> (raw)
My apologies if this is a beginners question...
I have two ASTs in different modules that look very much alike in
that some constructors have the same name and type name. When I
transform that ASTs I end up "re-applying" the similarly named
constructor and arguments. This is best explained with an example.
a.ml:
type typ =
| Integer
| Double
| String
| Boolean
b.ml:
type ty =
| Integer
| Double
| String
| Boolean
| Void
A transformation function would be
let conv_type = function
| A.Integer -> B.Integer
| A.String -> B.String
| A.Boolean -> B.Boolean
I don't want to share types between ASTs since, like above, some of
them may be supersets of others. How can I improve this with
polymorphic variants?
Thanks, Joel
--
http://wagerlabs.com/
next reply other threads:[~2007-04-25 4:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-25 4:19 Joel Reymont [this message]
2007-04-25 4:56 ` Joel Reymont
2007-04-25 5:54 ` [Caml-list] " skaller
2007-04-25 5:59 ` Joel Reymont
2007-04-25 6:28 ` Martin Jambon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15893C08-FD0C-456B-A12F-DADCF6CC95F9@gmail.com \
--to=joelr1@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox