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 MAA05316; Wed, 18 Jun 2003 12:41:08 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA05256 for ; Wed, 18 Jun 2003 12:41:07 +0200 (MET DST) Received: from axiom.anu.edu.au (axiom.anu.edu.au [150.203.127.200]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h5IAf5H17094 for ; Wed, 18 Jun 2003 12:41:06 +0200 (MET DST) Received: from pulp.anu.edu.au (pulp.anu.edu.au [150.203.126.25]) by axiom.anu.edu.au (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) with ESMTP id h5IAf3G05251 (using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified NO) for ; Wed, 18 Jun 2003 20:41:03 +1000 Received: from pulp.anu.edu.au (localhost [127.0.0.1]) by pulp.anu.edu.au (8.12.9/8.12.9/Debian-3) with ESMTP id h5IAf0B6025886 for ; Wed, 18 Jun 2003 20:41:00 +1000 Received: (from abate@localhost) by pulp.anu.edu.au (8.12.9/8.12.9/Debian-3) id h5IAf0MG025883 for caml-list@inria.fr; Wed, 18 Jun 2003 20:41:00 +1000 Date: Wed, 18 Jun 2003 20:41:00 +1000 From: Pietro Abate To: caml-list@inria.fr Subject: [Caml-list] type and modules... (sig mismatch again) Message-ID: <20030618104059.GA25514@anu.edu.au> Mail-Followup-To: Pietro Abate , caml-list@inria.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: GNU/Linux X-Organization: Research School of Information Science and Engineering (Australian National University) User-Agent: Mutt/1.5.4i X-Spam: no; 0.00; pietro:01 abate:01 mismatch:01 functor:01 val:01 struct:01 compiler:01 sig:01 int:01 variant:02 modules:02 enforce:02 module:03 behavior:03 daily:96 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi all, my daily question :-)) I would like to write a module definition as below: the problem is (of course) with the t1_t and t2_t type definition because the use the same variant names. however in my understanding the signature + the "(A with type t1 = t1_t and type t2 = t2_t)" bit in the functor declaration should be enough to make clear to the compiler that tutu gets t1 and return t2. Hence in the pattern matching the first A is of the type t1 and the B is of type t2. how can I force this behavior without changing t1_t and t2_t ? why the signature doesn't enforce the right type matching ? regards, pietro module type A = sig type t1 type t2 val tutu : t1 -> t2 end type t1_t = A of int type t2_t = A of int | B of int module Make : (A with type t1 = t1_t and type t2 = t2_t) = struct type t1 = t1_t type t2 = t2_t let tutu = function |A(x) -> B(x) end -- 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