From: Julien Signoles <Julien.Signoles@lri.fr>
To: Keiko Nakata <keiko@kurims.kyoto-u.ac.jp>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] a module with multiple signatures
Date: Thu, 2 Jun 2005 14:08:25 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.58.0506021403040.20156@pc8-102> (raw)
In-Reply-To: <20050602.201517.68552080.keiko@kurims.kyoto-u.ac.jp>
> This means that if I want to export T1 and T2 then I have to write as
> module M1 : sig type t = M.t = T1 | T2 end = M
> Is it correct?
Yes it is. It is exactly what J.C. Filliâtre propose.
> In my situation, M defines many types and many type constructors,
> and I want to give M different signatures, each of which will export
> different sets of type constructors.
> Then, it seems that I have to write the same type constructor declarations
> a number of times....
> Isn't it avoidable?
You can use the "include" statement:
module M = struct type s = S type t = T1 | T2 end
module type S = sig type s = M.s = S end
module type T = sig type t = M.t = T1 | T2 end
module type ST = sig include S include T end
module MS : S = M
module MT : T = M
module MST : ST = M
Julien
--
mailto:Julien.Signoles@lri.fr ; http://www.lri.fr/~signoles
"In theory, practice and theory are the same,
but in practice they are different" (Larry McVoy)
next prev parent reply other threads:[~2005-06-02 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-02 7:18 Keiko Nakata
2005-06-02 7:53 ` [Caml-list] " Julien Signoles
2005-06-02 11:15 ` Keiko Nakata
2005-06-02 12:08 ` Julien Signoles [this message]
2005-06-02 8:04 ` Jean-Christophe Filliatre
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=Pine.LNX.4.58.0506021403040.20156@pc8-102 \
--to=julien.signoles@lri.fr \
--cc=caml-list@inria.fr \
--cc=keiko@kurims.kyoto-u.ac.jp \
/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