From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: cet@webcriteria.com (Chris Tilt)
Cc: caml-list@inria.fr (OCAML)
Subject: Re: parameterized signatures
Date: Thu, 23 Dec 1999 11:44:53 +0100 (MET) [thread overview]
Message-ID: <199912231044.LAA07631@miss.wu-wien.ac.at> (raw)
In-Reply-To: <38612749.528896CB@webcriteria.com> from "Chris Tilt" at Dec 22, 99 11:32:25 am
Hello,
> Is there a way to refer to the type of a functor defined by a .mli file
> in another .mli file?
> =====> the problem area. How do I express the type of this module?
> module type Wgraph = Pgraph.S ???
Acessing .mli-files as signatures is currently not possible. If I remember
right, I have already asked once whether this could be allowed, but I was
told that this would cause confusions about module names and module-type
names.
Therefore, if I use functors I normally do not use an .mli-file to restrict
the interface, but split up the code in something like:
foo_intf.ml
foo_impl.ml
and restrict the modules/functors explicitely.
"foo_intf.ml" contains, for example:
module type SPEC = sig ... end
module type T = sig ... end
and "foo_impl.ml":
open Foo_intf
module Make (Spec : SPEC) : (T with ...) = struct ... end
Sometimes it is necessary to "reexport" types from the "specification"
module.
Then I do this like:
module Make (Spec_ : SPEC) : (T with ...) = struct
module Spec = Spec_
open Spec
...
end
Of course, the signature T will then have to include something like:
module type SPEC = sig ... end
module type T = sig
module Spec : SPEC
open Spec
end
and will thus make available all types in "Spec".
I hope this helps!
Best regards,
Markus Mottl
--
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl
prev parent reply other threads:[~1999-12-23 16:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-12-22 19:32 Chris Tilt
1999-12-23 10:44 ` Markus Mottl [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=199912231044.LAA07631@miss.wu-wien.ac.at \
--to=mottl@miss.wu-wien.ac.at \
--cc=caml-list@inria.fr \
--cc=cet@webcriteria.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