From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id BD85CBBE1 for ; Tue, 10 Oct 2006 12:28:49 +0200 (CEST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9AASnf9014816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 10 Oct 2006 12:28:49 +0200 Received: from courriel.upmc.fr (courriel3.reseau.jussieu.fr [134.157.0.194]) by shiva.jussieu.fr (8.13.7/jtpda-5.4) with ESMTP id k9AASmlC084539 ; Tue, 10 Oct 2006 12:28:48 +0200 (CEST) X-Ids: 164 Received: from etu.upmc.fr (localhost [127.0.0.1]) by courriel.upmc.fr (8.13.6/jtpda-5.4) with ESMTP id k9AASm5O010659 ; Tue, 10 Oct 2006 12:28:48 +0200 (CEST) Received: from out-of.ilog.fr (out-of.ilog.fr [81.80.159.49]) by webmail.etu.upmc.fr (Horde MIME library) with HTTP; Tue, 10 Oct 2006 12:28:48 +0200 Message-ID: <20061010122848.dcxzu0s11cwks8o8@webmail.etu.upmc.fr> Date: Tue, 10 Oct 2006 12:28:48 +0200 From: Diego Olivier FERNANDEZ PONS To: "ketty ." Cc: caml-list@inria.fr Subject: Re: [Caml-list] Type inference inside exceptions ? References: <20061006201647.1a88vj0tkockc4k8@webmail.etu.upmc.fr> <6ebe51ce0610061320s1ef4402al54de5bab22071f0f@mail.gmail.com> In-Reply-To: <6ebe51ce0610061320s1ef4402al54de5bab22071f0f@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.1.3) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (shiva.jussieu.fr [134.157.0.164]); Tue, 10 Oct 2006 12:28:48 +0200 (CEST) X-Virus-Scanned: ClamAV 0.88.2/2017/Tue Oct 10 08:15:58 2006 on shiva.jussieu.fr X-Virus-Status: Clean X-Miltered: at concorde with ID 452B75E1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 452B75E0.004 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; pons:01 pons:01 inference:01 type-checker:01 mutable:01 mutable:01 val:01 typechecker:01 inference:01 compiler:01 ketty:98 polymorphic:01 polymorphic:01 caml-list:01 exception:01 Quoting "ketty ." : >> I would like the type-checker to infer the type inside exceptions (or >> at least to help me in the "guess a type and test" loop). > > I'd like it to infer the types of record-fields as well :) WISH GRANTED. type ('a, 'b, 'c) environment = { mutable solutions : 'a; mutable backtracks : 'b; mutable objective : 'c } let min_card = fun env ... -> ... # val min_card : (int list list, int, int) environment -> int -> int list -> int list -> int list * int list continuation list = The typechecker inferred the type of your record-fields. Polymorphic exceptions are forbidden because they could break the type system, leading to a ['a -> 'b] type. That is why I asked for "type inference" or any kind of useful help and not for "polymorphic exceptions". I would accept the compiler to deny the use of the exception if it is not monomorphic. Diego Olivier