From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id IAA25294 for caml-redistribution; Fri, 30 May 1997 08:45:42 +0200 (MET DST) 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 VAA16958 for ; Thu, 29 May 1997 21:00:05 +0200 (MET DST) Received: from impsat.net.co ([200.31.17.65]) by concorde.inria.fr (8.8.5/8.7.3) with SMTP id VAA02777 for ; Thu, 29 May 1997 21:00:02 +0200 (MET DST) Received: from mposada.impsat.net.co by impsat.net.co (SMI-8.6/SMI-SVR4) id NAA26503; Thu, 29 May 1997 13:57:42 +0500 Message-ID: <338DD17B.62C6@impsat.net.co> Date: Thu, 29 May 1997 13:56:59 -0500 From: Ernesto Posse Reply-To: mposada@impsat.net.co X-Mailer: Mozilla 3.01Gold (Win95; I) MIME-Version: 1.0 To: Caml List Subject: Type constraints Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: weis [My apologies for not including a French Version] Hello. I have the folowing problem. I need to define some interrelated types as follows: type 'a node = {x: 'a; y: t1} and t1 = A | B of t1*t1 and t2 = C | D of (string * t2) node The interpreter prints the inferred type: type 'a node = { x: 'a; y: t1 } constraint 'a = string * t2 type t1 = | A | B of t1 * t1 type t2 = | C | D of (string * t2) node Now, if I add another constructor: type 'a node = {x: 'a; y: t1} and t1 = A | B of t1*t1 and t2 = C | D of (string * t2) node | E of bool node I obtain this message: Characters 98-102: This type parameter bool should be an instance of type string * t2 A solution to this would be something like: type ('a,'b) node = {x: 'a; y: 'b} and t1 = A | B of t1*t1 and t2 = C | D of (string * t2, t1) node | E of (bool, t1) node This works, but I am not sure to understand the type clash in the former example. Why did the type synthetizer infer that constraint? Thank you for any insights on this. -- Ernesto Posse Ingeniero de Sistemas y Computacion (Systems and Computing Engineer) Universidad de los Andes Santafe de Bogota Colombia e-mail: mposada@impsat.net.co