From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 7E6C67EE63 for ; Tue, 28 May 2013 08:36:58 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of flux@modeemi.cs.tut.fi) identity=pra; client-ip=130.230.4.42; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="flux@modeemi.cs.tut.fi"; x-sender="flux@modeemi.cs.tut.fi"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of flux@modeemi.cs.tut.fi) identity=mailfrom; client-ip=130.230.4.42; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="flux@modeemi.cs.tut.fi"; x-sender="flux@modeemi.cs.tut.fi"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail.cs.tut.fi) identity=helo; client-ip=130.230.4.42; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="flux@modeemi.cs.tut.fi"; x-sender="postmaster@mail.cs.tut.fi"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlABAM5PpFGC5gQqlGdsb2JhbABZFoMiwg2BHg4BAQEBCQsJCRQEJIIjAQEEAScTRAsLISUPAQQNC0SHewMJBrNwDYgajD8Hgl4Wgz4DiRmMPIFmgSmKdIg1 X-IPAS-Result: AlABAM5PpFGC5gQqlGdsb2JhbABZFoMiwg2BHg4BAQEBCQsJCRQEJIIjAQEEAScTRAsLISUPAQQNC0SHewMJBrNwDYgajD8Hgl4Wgz4DiRmMPIFmgSmKdIg1 X-IronPort-AV: E=Sophos;i="4.87,756,1363129200"; d="scan'208";a="19230683" Received: from mail.cs.tut.fi ([130.230.4.42]) by mail2-smtp-roc.national.inria.fr with SMTP; 28 May 2013 08:36:57 +0200 Received: from amavis2.cs.tut.fi (amavis2.cs.tut.fi [130.230.4.70]) by mail.cs.tut.fi (Postfix) with ESMTP id EB60FD17 for ; Tue, 28 May 2013 09:36:56 +0300 (EEST) Received: from mail.cs.tut.fi ([130.230.4.42]) by amavis2.cs.tut.fi (amavis2.cs.tut.fi [130.230.4.70]) (amavisd-maia, port 10024) with ESMTP id 24700-12 for ; Tue, 28 May 2013 09:36:56 +0300 (EEST) Received: from modeemi.modeemi.fi (modeemi.modeemi.fi [130.230.72.134]) by mail.cs.tut.fi (Postfix) with SMTP id 3720ED16 for ; Tue, 28 May 2013 09:36:56 +0300 (EEST) Received: from coffee.modeemi.fi (coffee.modeemi.fi [130.230.72.140]) by modeemi.modeemi.fi (Postfix) with ESMTP id 16AA719754 for ; Tue, 28 May 2013 09:36:56 +0300 (EEST) Received: by coffee.modeemi.fi (Postfix, from userid 17990) id 084212D6351; Tue, 28 May 2013 09:36:55 +0300 (EEST) From: Erkki Seppala To: caml-list@yquem.inria.fr References: <51A38A23.9000402@gmail.com> Date: Tue, 28 May 2013 09:36:55 +0300 In-Reply-To: <51A38A23.9000402@gmail.com> (Jacques-Pascal Deplaix's message of "Mon, 27 May 2013 18:30:27 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.2 X-Validation-by: flux@modeemi.fi Subject: Re: [Caml-list] Recursive fixed polymorphic variants Hello, Jacques-Pascal Deplaix writes: > let rec f = function `B x -> f x | `A -> ();; The problem is that 'f' has two final types in the same scope - or that's the best way I can describe it, someone can maybe chime in :). One way to solve it for this instance would be: let rec f = function `B x -> g x | `A -> () and g = function `B x -> f x | `A -> ();; # f (M.b (M.a ())) - : unit = () This gives f (and g) the inferred type ([< `A | `B of [< `A | `B of 'a ] ] as 'a) -> unit. I was under the impression I should be able to describe using the type variable syntax in function type, but I was unable to. -- _____________________________________________________________________ / __// /__ ____ __ http://www.modeemi.fi/~flux/\ \ / /_ / // // /\ \/ / \ / /_/ /_/ \___/ /_/\_\@modeemi.fi \/