From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA07726; Tue, 17 Jun 2003 15:52:24 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 PAA07769 for ; Tue, 17 Jun 2003 15:52:23 +0200 (MET DST) Received: from lri.lri.fr (lri.lri.fr [129.175.15.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h5HDqMT02904 for ; Tue, 17 Jun 2003 15:52:22 +0200 (MET DST) Received: from pc8-123 (pc8-123 [129.175.8.123]) by lri.lri.fr (8.11.6p2/jtpda-5.3.2) with ESMTP id h5HDkQt26666 ; Tue, 17 Jun 2003 15:46:26 +0200 (MEST) Received: from filliatr by pc8-123 with local (Exim 3.35 #1 (Debian)) id 19SGn4-0004Fw-00; Tue, 17 Jun 2003 15:46:26 +0200 From: Jean-Christophe Filliatre MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <16111.7090.128250.979329@gargle.gargle.HOWL> Date: Tue, 17 Jun 2003 15:46:26 +0200 To: Pietro Abate Cc: caml-list@inria.fr Subject: Re: [Caml-list] signature mismatch In-Reply-To: <20030617132753.GA20764@anu.edu.au> References: <20030617132753.GA20764@anu.edu.au> X-Mailer: VM 7.03 under Emacs 20.7.2 Reply-To: Jean-Christophe.Filliatre@lri.fr (Jean-Christophe Filliatre) X-MailScanner: Found to be clean X-Spam: no; 0.00; filliatre:01 filliatr:01 lri:01 caml-list:01 mismatch:01 pietro:01 abate:01 val:01 enforced:01 functor:01 struct:01 bug:01 faq:01 beginner's:01 beginners:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Pietro Abate writes: > Hi all, > I get this error trying to compile the file below: > > File "pp.ml", line 28, characters 22-24: > Signature mismatch: > Modules do not match: > sig type t = BB.t val toast : t -> t -> bool end > is not included in > sig type t = AA.t val toast : t -> t -> bool end > Type declarations do not match: > type t = BB.t > is not included in > type t = AA.t > > how can I force BB.t to be the same as AA.t ? > why it's not enforced by the functor declaration (with type...) ? Types AA.t and BB.t are abstract, due to the declarations "module AA : A1" and "module BB : A2" and to the fact that "t" is abstract in both interfaces A1 and A2. You should write instead module AA : A1 with type t = int = ... module BB : A2 with type t = int = ... module C = Make (AA) (BB) (Another possibility is to declare "type t = int" in both signatures A1 and A2 but it is probably not what you want to do.) -- Jean-Christophe Filliātre (http://www.lri.fr/~filliatr) > ----------------- > module type A1 = sig > type t > val test : t -> t -> bool > end > > module type A2 = sig > type t > val toast : t -> t -> bool > end > > module Make (A : A1 ) (B : A2 with type t = A.t) = struct > let fifi a b c = > if c > 1 then A.test a b > else B.toast b a > end > > module AA : A1 = struct > type t = int > let test f1 f2 = true > end > > module BB : A2 = struct > type t = int > let toast f1 f2 = false > end > > module C = Make (AA) (BB) > > --------------------- > > -- > Civilization advances by extending the number > of important operations which we can perform > without thinking. (Alfred North Whitehead) > > ------------------- > To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr > Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners