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 OAA19345 for caml-redistribution; Mon, 2 Jun 1997 14:22:06 +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 JAA26570 for ; Fri, 30 May 1997 09:41:12 +0200 (MET DST) Received: from indigo.recherche.enac.fr (root@indigo.recherche.enac.fr [195.220.158.66]) by concorde.inria.fr (8.8.5/8.7.3) with SMTP id JAA08132 for ; Fri, 30 May 1997 09:41:10 +0200 (MET DST) Received: from cyan.recherche.enac.fr (cyan.recherche.enac.fr [195.220.158.73]) by indigo.recherche.enac.fr (8.6.12/8.6.11) with SMTP id JAA23620 for ; Fri, 30 May 1997 09:41:10 +0200 Message-Id: <199705300741.JAA23620@indigo.recherche.enac.fr> Received: by cyan.recherche.enac.fr (1.38.193.4/16.2) id AA08622; Fri, 30 May 1997 09:41:10 +0200 Date: Fri, 30 May 1997 09:41:10 +0200 From: Pascal Brisset To: caml-list@pauillac.inria.fr Subject: Type constraints In-Reply-To: <338DD17B.62C6@impsat.net.co> References: <338DD17B.62C6@impsat.net.co> Sender: weis Ernesto Posse writes: « 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 It may be compared to a similar expression at the term level: # let rec f = fun x -> x and g = f 1, f "1";; ^^^ This expression has type string but is here used with type int In a recursive definition, occurrences of the defined idents have the same type everywhere, i.e. the generalization (in your case, 'a is any type) is done only ``at the end'' of the definition. At the term level, ML+ is the (undecidable) solution to this kind of recursive definition. I guess problems are similar at the type level. A more precise answer from a Caml guru ? --Pascal Brisset