caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@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 10:04:07 +0200	[thread overview]
Message-ID: <17054.48503.615769.712007@gargle.gargle.HOWL> (raw)
In-Reply-To: <20050602.161836.68553253.keiko@kurims.kyoto-u.ac.jp>


Keiko Nakata writes:
 > 
 > I tried to give a module different signatures through an use of functors.
 > Then I faced a situation for which I do not understand the reason.
 > 
 > This is the simplified version of my situation.
 > [...]
 > Anyway,
 > there may be a nicer way to give a module multiple signatures
 > while avoiding duplicate type declarations as possible?
 > (In the above setting, I want to make the type s in M abstract in some 
 > context, but transparent in another context.)

I think you can proceed as follows:

  module M = struct type s type t = A | B end
  module M1 : sig type t = M.t = A | B end = M
  module M2 : ... = M

i.e. you cannot put only "t = M.t" in the signature of M1, you need to
add "=  A|B". This is called  a "re-exported variant  type" in Ocaml's
manual (see http://caml.inria.fr/pub/docs/manual-ocaml/manual018.html)

-- 
Jean-Christophe


      parent reply	other threads:[~2005-06-02  8:04 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
2005-06-02  8:04 ` Jean-Christophe Filliatre [this message]

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=17054.48503.615769.712007@gargle.gargle.HOWL \
    --to=jean-christophe.filliatre@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;
as well as URLs for NNTP newsgroup(s).