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 LAA29297 for caml-redistribution; Fri, 30 May 1997 11:52:57 +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 LAA28633 for ; Fri, 30 May 1997 11:25:03 +0200 (MET DST) Received: from fermi.cnam.fr (fermi.cnam.fr [163.173.128.60]) by concorde.inria.fr (8.8.5/8.7.3) with ESMTP id LAA11275 for ; Fri, 30 May 1997 11:25:02 +0200 (MET DST) Received: from fermi.cnam.fr (fermi.cnam.fr [163.173.128.60]) by fermi.cnam.fr (8.8.5/jpm-961216) with SMTP id LAA26628 ; Fri, 30 May 1997 11:24:21 +0200 (MET DST) Message-ID: <338E9CC5.41C6@cnam.fr> Date: Fri, 30 May 1997 11:24:21 +0200 From: Didier Rousseau Organization: CNAM X-Mailer: Mozilla 3.01Gold (X11; I; OSF1 V3.2 alpha) MIME-Version: 1.0 To: mposada@impsat.net.co CC: caml-list@pauillac.inria.fr Subject: Re: Type constraints References: <338DD17B.62C6@impsat.net.co> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: weis bonjour a tous, Ernesto Posse wrote: > > [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 > ... une solution est de declarer : type 'a node = {x: 'a; y: t1} and t1 = A | B of t1*t1 ;; type t2 = C | D of (string * t2) node | E of bool node ;; Didier Rousseau