From: skaller <skaller@users.sourceforge.net>
To: Joel Reymont <joelr1@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Transforming of ASTs and polymorphic variants
Date: Wed, 25 Apr 2007 15:54:05 +1000 [thread overview]
Message-ID: <1177480445.7544.14.camel@rosella.wigram> (raw)
In-Reply-To: <15893C08-FD0C-456B-A12F-DADCF6CC95F9@gmail.com>
On Wed, 2007-04-25 at 05:19 +0100, Joel Reymont wrote:
> 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 (x:A.typ): B.ty = match x with
| x -> (x : A.typ :> B.ty)
A simpler implementation:
let conv_type x = (x : A.typ :> B.ty)
will also work in this case.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
next prev parent reply other threads:[~2007-04-25 5:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-25 4:19 Joel Reymont
2007-04-25 4:56 ` Joel Reymont
2007-04-25 5:54 ` skaller [this message]
2007-04-25 5:59 ` [Caml-list] " 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=1177480445.7544.14.camel@rosella.wigram \
--to=skaller@users.sourceforge.net \
--cc=caml-list@inria.fr \
--cc=joelr1@gmail.com \
/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