From: Alex Baretta <alex@baretta.com>
To: Ocaml <caml-list@inria.fr>
Subject: [Caml-list] What about polymorphic union types in functors?
Date: Fri, 06 Feb 2004 16:51:22 +0100 [thread overview]
Message-ID: <4023B7FA.9080705@baretta.com> (raw)
Here what I need to do:
module type FRAGMENT = sig
type foo (* Closed polymorphic union type *)
val do_something : foo -> whatever
end
module Merge_fragments (F1:FRAGMENT) (F2:FRAGMENT) : #FRAGMENT = struct
type foo = [ F1.foo | F2.foo ]
let do_something = function
| #F1.foo as f1 -> F1.do_something f1
| #F2.foo as f2 -> F2.do_something f2
end
Up to now I have used automatic code generation to actually write the ML
file which implements the functor istantiation. Could such an extension
be made to Ocaml type system?
Alex
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next reply other threads:[~2004-02-06 15:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-06 15:51 Alex Baretta [this message]
2004-02-06 17:43 ` brogoff
2004-02-06 18:58 ` Alex Baretta
2004-02-09 1:40 ` Jacques Garrigue
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=4023B7FA.9080705@baretta.com \
--to=alex@baretta.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