From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA15406 for caml-redistribution; Thu, 23 Dec 1999 17:38:25 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA09276 for ; Thu, 23 Dec 1999 11:45:16 +0100 (MET) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id LAA26549 for ; Thu, 23 Dec 1999 11:45:15 +0100 (MET) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id LAA07631; Thu, 23 Dec 1999 11:44:53 +0100 (MET) From: Markus Mottl Message-Id: <199912231044.LAA07631@miss.wu-wien.ac.at> Subject: Re: parameterized signatures To: cet@webcriteria.com (Chris Tilt) Date: Thu, 23 Dec 1999 11:44:53 +0100 (MET) Cc: caml-list@inria.fr (OCAML) In-Reply-To: <38612749.528896CB@webcriteria.com> from "Chris Tilt" at Dec 22, 99 11:32:25 am X-Mailer: ELM [version 2.4 PL21] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: weis 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