From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id QAA07537 for caml-redistribution; Tue, 22 Oct 1996 16:28:18 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id QAA11617 for ; Mon, 21 Oct 1996 16:19:26 +0200 Received: from margaux.inria.fr (margaux.inria.fr [128.93.8.2]) by concorde.inria.fr (8.7.6/8.7.1) with ESMTP id QAA21772 for ; Mon, 21 Oct 1996 16:19:23 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by margaux.inria.fr (8.7.6/8.7.3) with ESMTP id QAA02636 for ; Mon, 21 Oct 1996 16:19:25 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.7.6/8.7.1) with ESMTP id QAA21764; Mon, 21 Oct 1996 16:19:22 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id QAA11605; Mon, 21 Oct 1996 16:19:18 +0200 From: Xavier Leroy Message-Id: <199610211419.QAA11605@pauillac.inria.fr> Subject: Re: Yet another question about the module system To: jserot@epcc.ed.ac.uk (Jocelyn Serot) Date: Mon, 21 Oct 1996 16:19:18 +0200 (MET DST) Cc: caml-list@margaux.inria.fr In-Reply-To: <17349.199610180841@tufa.epcc.ed.ac.uk> from "Jocelyn Serot" at Oct 18, 96 09:41:36 am MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis > Suppose i have 2 files: > > A first one, specifying an interface for an abstract type Bar: > > ****** bar.mli ********** > type t > val x :t > ************************* > > A second one, specifying a second abstract type built upon the first one > using functor application > > ****** foo.mli ********** > module type FOO = sig type t val y : t end > module Make(B:Bar) : (FOO with type t = Bar.t) > ************************* > > Trying to compile this separately: > > > ocamlc -c bar.mli > > ocamlc -c foo.mli > > produces the following error message: > > File "foo.mli", line 3, characters 14-17: Unbound module type Bar Having a bar.cmi file around defines a module named "Bar", but not a module type named "Bar". You're confusing a module "value" (a module implementation, such as Bar) with a module type (a module specification, such as the one expected for the type of the module parameter B). > So, it seems that the Bar interface is known when compiling Foo (i guess this > goes trough the bar.cmi file). > Why cannot it be used as a functor argument then ? It can be used as a functor argument, as in module B = Foo.Make(Bar) but not as the type of a functor parameter, as in your example. - Xavier Leroy