From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 189957EC41 for ; Fri, 19 Oct 2012 23:18:22 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of yminsky@janestreet.com) identity=pra; client-ip=38.105.200.112; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="yminsky@janestreet.com"; x-sender="yminsky@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of yminsky@janestreet.com designates 38.105.200.112 as permitted sender) identity=mailfrom; client-ip=38.105.200.112; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="yminsky@janestreet.com"; x-sender="yminsky@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@nyc-dmz-mxout1.janestreet.com) identity=helo; client-ip=38.105.200.112; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="yminsky@janestreet.com"; x-sender="postmaster@nyc-dmz-mxout1.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhUBALTCgVAmachwl2dsb2JhbABFwG4rAQEBAQEIFgc7gjkCLAEBNwElXRIBBQFXh2IDnWAJA4prhDMBBY8oBo8mgyOVco5XFimELYF8 X-IronPort-AV: E=Sophos;i="4.80,617,1344204000"; d="scan'208";a="178073158" Received: from mx1.janestreet.com (HELO nyc-dmz-mxout1.janestreet.com) ([38.105.200.112]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 19 Oct 2012 23:18:21 +0200 Received: from nyc-qsv-mail1.delacy.com ([172.25.22.57]) by nyc-dmz-mxout1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1TPJxU-0005c5-H0 for caml-list@inria.fr; Fri, 19 Oct 2012 17:18:20 -0400 Received: from nyc-dmz-mxgoog1.delacy.com ([172.25.224.109] helo=mxgoog1.janestreet.com) by nyc-qsv-mail1.delacy.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TPJxU-0006Up-F3 for caml-list@inria.fr; Fri, 19 Oct 2012 17:18:20 -0400 Received: from mail-gh0-f197.google.com ([209.85.160.197]) by mxgoog1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1TPJxU-00043M-D1 for caml-list@inria.fr; Fri, 19 Oct 2012 17:18:20 -0400 Received: by mail-gh0-f197.google.com with SMTP id f16so1909242ghb.0 for ; Fri, 19 Oct 2012 14:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:x-originating-ip:date:message-id:subject:from:to:cc :content-type; bh=aCXb2T8sNC2OrOlw6sXf2WHP+6UaA1/0eyjphdvrdlE=; b=xm0Vz6n2rxm+VNZpcd4ashspxb+RT9AiQRmOdkML8ONCwfRFcw3PT79TJCsy9SIxGV Vk9H5bMVwlexyfD6uXb+27POa850jKdCUOpzztfvfdnOW04mFdh7q3HdwLk21uYp+7pu CHFeE71RowLH7aPOFKUEPB1ydgDzLS191+P2M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:date:message-id:subject:from:to:cc :content-type:x-gm-message-state; bh=aCXb2T8sNC2OrOlw6sXf2WHP+6UaA1/0eyjphdvrdlE=; b=lXn5YQ+pjPRjLFRRtoUd1CI4KgOa2CmdU7dm5mQNOuIKDjWuTxgKk73rZQCtRA4Vzx kahYpjQyGzpi3Bg2SxFOhZ9rEyVSzNbqXEVuyFh4COxfbmKjgXXMfOtx1QHAox6fDGHJ 1IAEmPirxfeh603cI4R0DLmkGiqbEOFKYJiR4eL2zVPmDohgSyJhJPOQDq0JAdKG9L2W rn1sayRGQ2CjrRalDua6ieIU8YFEl4+3vaE7KWjPrCLRkdxHycsG+5Cjz0ccvHLJkpmr SR4JgbKrHhcgfjkdxi8P2W/ozfEJN7ETO9LpUy35zMlieqbQAe/qtNIxJWLPoG+Y4pNt RnZA== Received: by 10.52.33.165 with SMTP id s5mr2697116vdi.55.1350681500116; Fri, 19 Oct 2012 14:18:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.33.165 with SMTP id s5mr2697106vdi.55.1350681499966; Fri, 19 Oct 2012 14:18:19 -0700 (PDT) Received: by 10.58.203.225 with HTTP; Fri, 19 Oct 2012 14:18:19 -0700 (PDT) X-Originating-IP: [38.105.200.252] Date: Fri, 19 Oct 2012 17:18:19 -0400 Message-ID: From: Yaron Minsky To: caml-list@inria.fr Cc: Stephen Weeks , David Powers , Nathan Linger Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkth6Y4NFdAELypjpoaqTjcrXuRE7bydSbhaOAaONDtN1kEas1AxzxIwTZeqVt76PsgS/cUQHLxcDNX6XtcP447NmDyKc9G85RqZg/if/2fr09QKi93ojzdEZCeFGiIys64JbPCYt9lBBzCosuHKd3SSq37Fg== Subject: [Caml-list] A confusing example with modules and polymorphic variants Sorry for the previous incomplete message. Over-eager return key. We've been running into some troubles with polymorphic variants, modules, and the value restriction, that we're not quite able to unravel. Here's a stripped down version of the problem. module type S = sig val z : [< `Foo ] end let f z = let module M : S = struct let z = z end in () Roughly speaking, we have a module signature S with a value that's a polymorphic variant type that is not exact (i.e., has some polymorphism in it.) The function f then tries to construct a module of that type, by taking the input value and stuffing it into a locally defined module. When we do this, however, we're hit by a non-generalizable value complaint. Modules do not match: sig val z : '_a end is not included in S Values do not match: val z : '_a is not included in val z : [< `Foo ] File "z.ml", line 2, characters 2-19: Expected declaration File "z.ml", line 7, characters 8-9: Actual declaration Any thoughts on why this doesn't work, and how one could get it to?