From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p1LKNK7v023186 for ; Mon, 21 Feb 2011 21:23:20 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoUHALNYYk1ii1vRWmdsb2JhbACYAI5IARYKCwQSBSGqXYIchG6JCQEEBAGFWQSFDYpB X-IronPort-AV: E=Sophos;i="4.62,202,1297033200"; d="scan'208";a="88423430" Received: from nm15-vm1.bullet.mail.sp2.yahoo.com ([98.139.91.209]) by mail4-smtp-sop.national.inria.fr with SMTP; 21 Feb 2011 21:23:14 +0100 Received: from [98.139.91.64] by nm15.bullet.mail.sp2.yahoo.com with NNFMP; 21 Feb 2011 20:23:11 -0000 Received: from [98.139.91.22] by tm4.bullet.mail.sp2.yahoo.com with NNFMP; 21 Feb 2011 20:22:43 -0000 Received: from [127.0.0.1] by omp1022.mail.sp2.yahoo.com with NNFMP; 21 Feb 2011 20:22:43 -0000 X-Yahoo-Newman-Property: ymail-5 X-Yahoo-Newman-Id: 393770.21290.bm@omp1022.mail.sp2.yahoo.com Received: (qmail 27370 invoked by uid 60001); 21 Feb 2011 20:22:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1298319762; bh=muikYwWDg4QsY5At+bDYEJQp7c4TbEGOrjOqKw/JhxY=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=lqK0+2tN32x7h3dC9xcmLC0LFhUvxZkY8H2Bjb1N8saQvKAk8d2BV4Eg2wV6shhjDFmDUdCzMqXB3begziOkLH+ND85V7B3rNRqBQwFobmFJVAv88HDffr1mKdMmN8VDsXPVu7c9MfJQVPkvhkekzKfqdwBGjb+GFEA7MX/lEVk= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=J6OWBHIIPShNsb9T9P1ZSPeuJyf7JAo0o8SZxNDBGiltmK2q9E2EHf9U+uEBFvHqLubbRNztdR5IWZ6elMKMI0kH7XjzTD5WHV679l2pBd3yqIpBUpI0pXwdUT7QrkszCH3pJdG2O0jE1K77TDyqfoaZOohrRtgguTVsG0/azxI=; Message-ID: <878199.20657.qm@web111516.mail.gq1.yahoo.com> X-YMail-OSG: bEzYSr0VM1kX6vQr2DkkkpBoUBibL0RaDF0tvn7sB7jDvMe f6L.OryvjgIUDyzD9jqTl5.P6V4Y5KZjcThAsVjEi6z.mjbLQXbJRvMFsWMu MmXCXozwBcfq.0opBP0VmWHj.vwRMW.mNsTjSnfm0LRZD4h3d0mEYcanOrXl IRdiN2gZ1PLHBtvVx0anw23eLcXaAoxzqIATh1H4ycnhq6EkAYTlRbFDaTkV hovta1ZcOufKvtUH9MO35zPSwWyxu81I1UO6qpBlCl.Rc4SPtXXc4YxOu7L8 VokuGCifwd2BrWYN5Rav6tKuLcwkbjWcg2nQanyBb7.lRcQbod0sfMTLg4nh .uwM6HH.f0m.mhYPndPhGH5Ic2qgfxCUtrKAsUYLm.VUDZCQzk9f50LGf4Zk MXHmFWLL1XLaV Received: from [213.205.70.206] by web111516.mail.gq1.yahoo.com via HTTP; Mon, 21 Feb 2011 12:22:42 PST X-Mailer: YahooMailClassic/11.4.20 YahooMailWebService/0.8.109.292656 Date: Mon, 21 Feb 2011 12:22:42 -0800 (PST) From: Dario Teixeira To: =?iso-8859-1?Q?Daniel_B=FCnzli?= Cc: caml-list@inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p1LKNK7v023186 Subject: Re: [Caml-list] Constraining abstract type to be of a given subtype Hi, > Abstraction is about hiding type representation. Variant subtyping is > a kind of structural subtyping and is thus about type representation. > So constraining an abstract type to be of a given structural subtype > seems contradictory. Yes, you're right, I abused the term "abstract type", when I meant to say that the type exposed by the interface was not your run-of-the-mill concrete type but instead any type that satisfied a given constraint. What would be the proper terminology in this case? > The only way I see to type what you want is to make FOO.kind_t > abstract. This doesn't ensure that the implementation of 'a kind_t is > a subtype of Kind.t itself. However if your goal is some kind of > phantom type constraints, it will do the job. And you can still > require a function to convert 'a kind to Kind.t. See the code below. Which does work quite nicely, thanks! Cheers, Dario