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 QAA08007; Tue, 17 Jun 2003 16:04:15 +0200 (MET DST) 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 QAA08348 for ; Tue, 17 Jun 2003 16:04:14 +0200 (MET DST) Received: from indyio.rz.uni-saarland.de (indyio.rz.uni-saarland.de [134.96.7.3]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h5HE4ET03416 for ; Tue, 17 Jun 2003 16:04:14 +0200 (MET DST) Received: from uni-sb.de (uni-sb.de [134.96.7.230]) by indyio.rz.uni-saarland.de (8.12.9/8.12.5) with ESMTP id h5HE4Dai7458471 for ; Tue, 17 Jun 2003 16:04:13 +0200 (CEST) Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.252.31]) by uni-sb.de (8.12.9/2003020700) with ESMTP id h5HE4CVU029130 for ; Tue, 17 Jun 2003 16:04:13 +0200 (CEST) Received: from mail.cs.uni-sb.de (mail.cs.uni-sb.de [134.96.254.200]) by cs.uni-sb.de (8.12.9/2003020700) with ESMTP id h5HE3tst024049 for ; Tue, 17 Jun 2003 16:04:12 +0200 (CEST) Received: from ps.uni-sb.de (grizzly.ps.uni-sb.de [134.96.186.68]) by mail.cs.uni-sb.de (8.12.9/2003061700) with ESMTP id h5HE1HdF018628 for ; Tue, 17 Jun 2003 16:01:17 +0200 (CEST) X-Authentication-Warning: email: Host grizzly.ps.uni-sb.de [134.96.186.68] claimed to be ps.uni-sb.de Received: from ps.uni-sb.de (zoidberg.ps.uni-sb.de [134.96.186.121]) by ps.uni-sb.de (8.11.6/8.11.0) with ESMTP id h5HE1HU13269; Tue, 17 Jun 2003 16:01:17 +0200 Message-ID: <3EEF1F2C.1060903@ps.uni-sb.de> Date: Tue, 17 Jun 2003 16:01:16 +0200 From: Andreas Rossberg User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 X-Accept-Language: de, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] signature mismatch References: <20030617132753.GA20764@anu.edu.au> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; rossberg:01 uni-sb:01 caml-list:01 mismatch:01 pietro:01 abate:01 struct:01 enforced:01 functor:01 abstraction:01 darkened:01 munching:01 repetitive:01 kristian:01 compiler:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Pietro Abate wrote: > > how can I force BB.t to be the same as AA.t ? module BB : A2 with type t = A1.t = struct type t = A1.t let toast f1 f2 = false end > why it's not enforced by the functor declaration (with type...) ? Well, it is, but probably in a sense different from what you think. That's why the compiler complains, because the constraint is not satisfied for the arguments you pass to the functor. When you write > module AA : A1 = ... You declare module AA and introduce an abstract type t. That means that AA.t is a fresh type, distinct from any other type in your program. Likewise with > module BB : A2 = ... In particular, both types are distinct from each other (and int!). Consequently, > module C = Make (AA) (BB) is not well typed, because the constraint you state on Make's arguments requires AA.t and BB.t to be equivalent, which they aren't. The solution, as sketched above, is to avoid type abstraction for at least one of the modules. Hope this helps, | Andreas -- Andreas Rossberg, rossberg@ps.uni-sb.de "Computer games don't affect kids; I mean if Pac Man affected us as kids, we would all be running around in darkened rooms, munching magic pills, and listening to repetitive electronic music." - Kristian Wilson, Nintendo Inc. ------------------- 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