caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: jserot@epcc.ed.ac.uk (Jocelyn Serot)
Cc: caml-list@margaux.inria.fr
Subject: Re: Yet another question about the module system
Date: Mon, 21 Oct 1996 16:19:18 +0200 (MET DST)	[thread overview]
Message-ID: <199610211419.QAA11605@pauillac.inria.fr> (raw)
In-Reply-To: <17349.199610180841@tufa.epcc.ed.ac.uk> from "Jocelyn Serot" at Oct 18, 96 09:41:36 am


> 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





  reply	other threads:[~1996-10-22 14:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-18  8:41 Jocelyn Serot
1996-10-21 14:19 ` Xavier Leroy [this message]
1996-10-21 14:44   ` Jocelyn Serot

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=199610211419.QAA11605@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@margaux.inria.fr \
    --cc=jserot@epcc.ed.ac.uk \
    /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).