caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Transforming of ASTs and polymorphic variants
@ 2007-04-25  4:19 Joel Reymont
  2007-04-25  4:56 ` Joel Reymont
  2007-04-25  5:54 ` [Caml-list] " skaller
  0 siblings, 2 replies; 5+ messages in thread
From: Joel Reymont @ 2007-04-25  4:19 UTC (permalink / raw)
  To: Caml List

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/






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

end of thread, other threads:[~2007-04-25  6:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-25  4:19 Transforming of ASTs and polymorphic variants Joel Reymont
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).