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=2.0 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 4F26FBBAF for ; Wed, 11 Mar 2009 15:44:17 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlgCABBrt0lKfVwak2dsb2JhbACCfpFyPwEBAQEJCQoJEQOqVYEGj3IBAwEDhAoGhng X-IronPort-AV: E=Sophos;i="4.38,343,1233529200"; d="scan'208";a="24177884" Received: from qw-out-2122.google.com ([74.125.92.26]) by mail3-smtp-sop.national.inria.fr with ESMTP; 11 Mar 2009 15:44:16 +0100 Received: by qw-out-2122.google.com with SMTP id 8so34289qwh.33 for ; Wed, 11 Mar 2009 07:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=2tv+fILaUEFsDzI95k+KDf31thDvRJQ1hFjUeV2IwtY=; b=JNWGlEotd8fuzOK2LOGkVBi2iC7qBXniPGWIjZqbgqClHTWqAesxLl+/zCGraAr4Wm SuE95CY2v8ctwXd4WS6eWM6g/Js/qqyNRygIFBqP+pQ7/6j3uMly8hiXuOLSMqRtCQyG 72u9rHjRxGQELeSicQlsNTll2P4CJtx9OLxPc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Qq7Nmm0rCH40qY1A5S9lx+/XW+406DzV1uxL8qZfGGEusRUu8sL0kMB2GFW++Iw05i CxoS/29/MUVLs/pQD1jOCRFOQ3VO3l6MXOAtNnSC0VwlwMqXhxBfO2S7Zc/e55hZWyYD DkDe8IjPy+EXwUrWCN85ezI6sI35dukcATXBA= MIME-Version: 1.0 Received: by 10.220.95.68 with SMTP id c4mr3195701vcn.25.1236782653072; Wed, 11 Mar 2009 07:44:13 -0700 (PDT) In-Reply-To: <6D1EF1C5-3561-4D45-AE32-48F80EC84E58@cs.princeton.edu> References: <87prgoydy1.fsf@aryx.cs.uiuc.edu> <21952156.346634.1236751878001.JavaMail.www@wwinf1b03> <6D1EF1C5-3561-4D45-AE32-48F80EC84E58@cs.princeton.edu> Date: Wed, 11 Mar 2009 10:44:12 -0400 Message-ID: Subject: Re: [Caml-list] typing problem with sexplib and mutually recursive polymorphic types From: Markus Mottl To: Yitzhak Mandelbaum Cc: yoann padioleau , Caml-list List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; recursive:01 markus:01 mottl:01 markus:01 mottl:01 yitzhak:01 mandelbaum:01 inference:01 recursion:01 undecidable:01 ocaml:01 haskell:01 ocaml:01 compiler:01 compiler:01 On Wed, Mar 11, 2009 at 10:32, Yitzhak Mandelbaum wrote: > While I'm not sure it will help you in this case (because the code is > generated), I should note that type *inference* for polymorphic recursion is > undecidable, but type *checking* is not. Moreover, its pretty easy to do in > OCaml (if a bit clunky). That's true, but unlike Haskell OCaml doesn't have mandatory types. This means the user can't force the compiler to start out with user-provided type declarations. The OCaml compiler will always run type inference first and only try to unify the result with the user-provided type declaration, i.e. when it's too late. Of course, there are workarounds (recursive modules, polymorphic record fields), but, as you said, they are clunky indeed... Cheers, Markus -- Markus Mottl http://www.ocaml.info markus.mottl@gmail.com