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 B743B7ED34 for ; Mon, 16 Jul 2012 17:12:47 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of darioteixeira@yahoo.com) identity=pra; client-ip=98.139.91.190; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="darioteixeira@yahoo.com"; x-sender="darioteixeira@yahoo.com"; x-conformance=sidf_compatible Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of darioteixeira@yahoo.com) identity=mailfrom; client-ip=98.139.91.190; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="darioteixeira@yahoo.com"; x-sender="darioteixeira@yahoo.com"; x-conformance=sidf_compatible Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@nm4-vm0.bullet.mail.sp2.yahoo.com) identity=helo; client-ip=98.139.91.190; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="darioteixeira@yahoo.com"; x-sender="postmaster@nm4-vm0.bullet.mail.sp2.yahoo.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoMDAEMuBFBii1u+aWdsb2JhbAA4DQ6oFJE3DQkLBxMGJIIbBQEBBAELHAQVAQIVIQEBAwsGBUYvAQ4BBhIGiBABAQIGBgSqIQmCaIRgASMDASMDiVEBBgoBAZF7A4hLjHeFTy1NiFqDAlk X-IronPort-AV: E=Sophos;i="4.77,594,1336341600"; d="scan'208";a="167040116" Received: from nm4-vm0.bullet.mail.sp2.yahoo.com ([98.139.91.190]) by mail1-smtp-roc.national.inria.fr with SMTP; 16 Jul 2012 17:12:46 +0200 Received: from [98.139.91.66] by nm4.bullet.mail.sp2.yahoo.com with NNFMP; 16 Jul 2012 15:12:45 -0000 Received: from [98.139.91.56] by tm6.bullet.mail.sp2.yahoo.com with NNFMP; 16 Jul 2012 15:12:45 -0000 Received: from [127.0.0.1] by omp1056.mail.sp2.yahoo.com with NNFMP; 16 Jul 2012 15:12:45 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 857472.76115.bm@omp1056.mail.sp2.yahoo.com Received: (qmail 74685 invoked by uid 60001); 16 Jul 2012 15:12:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1342451565; bh=HGnGO3YVAgukEdqjeYpp5VlnWvTfjz8ibEbPkdXllnU=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=fbD8DM1ESyz4/nILVa9PLzIA7KvNxsHKer9RM9KOf8UUwVxVvEjNGnJUS9pQRCc5dNBr4oJCmmCj9RRUB56wqYkzoNorBmfU1LTvT1e5L7wB1IVJAPSjeFZJoXDA5fprwPiXr1nRoBGmcstDoqHpJxNA+OLEQ8p7iDJyW2BLbAw= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=R2f35Uqjj3HhW6HbXl9HEbPPqP8u+Hcm44dPf9bYQgX5zTOGXjCj+PXIoFq2ioRkws+Zef3siTlMxox7GdDxCMXY8zRM+Io41rs0n/fZR+2enOEtaeuVm9t9L94LEKIhx5xXZ98MoKKlBMGewiRunByzLJiTvoGoQal4cDcFUGI=; X-YMail-OSG: 2kLf..oVM1lggbCvtzdSm70uOECU1yk79vrXd6qvEgokXUE amNdgOt_16LW5owmMhK2zcuHbl6hPloqw13JLl9REmGCSuEEyHUOHt5nb_oK dA4u3dvweHla3u5VSVYXNZznjRgrT8JvfqijHeP0LP2Mx5wLqRGfex.T6Y09 81IigdGK78ajxk8cbDT21qqCC_1ShqcPudZgRkKBEMN2nDIHmIbSweBs7e8w g7RdA1rvbpUJUyWDGhxmGXIzCpPmTdsPQES5aAca39vvxpfkv2AHpvEX__Ml e8Qn0VEwEF9XvBkIMQECBhh_R9QFfEFd8hYa_owzPWbUJcCIV5kEJ5toWZ.1 oVBsUHFKq65gkhMWuf2mByGqK3mmFXYT73hfxVTdG.d6u_JMIdOsPydYmeZQ RxqlZiCoU1w8QthHpppunfDECZxom_LmAPJ2ZTT51KAkIGgXbQ1lNlC1EMXd audHxemaD Received: from [195.23.39.54] by web111507.mail.gq1.yahoo.com via HTTP; Mon, 16 Jul 2012 08:12:45 PDT X-Mailer: YahooMailWebService/0.8.120.356233 References: <1342371289.7422.YahooMailNeo@web111511.mail.gq1.yahoo.com> <068D1036-F986-4349-9EEA-B4D7453D5180@math.nagoya-u.ac.jp> Message-ID: <1342451565.67265.YahooMailNeo@web111507.mail.gq1.yahoo.com> Date: Mon, 16 Jul 2012 08:12:45 -0700 (PDT) From: Dario Teixeira Reply-To: Dario Teixeira To: Jacques Garrigue Cc: "caml-list@inria.fr" In-Reply-To: <068D1036-F986-4349-9EEA-B4D7453D5180@math.nagoya-u.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] GADTs and parsers Hi, > Here is a more complete version of his code. > I also changed a bit your types, because there is another problem > using polymorphic variants with GADTs: when you get a GADT > equation involving a refinable polymorphic variant, you are going > to get get a local private type. If your type is unbounded, you > cannot even use subtyping on it. Also [< `Nonlink] has exactly > the same elements as [ `Nonlink], so it is better to use the latter. >=20 > =A0 Jacques >=20 > type inkind =3D [ `Link | `Nonlink ] >=20 > type _ inline_t =3D > =A0 =A0 | Text: string -> [< inkind > `Nonlink ] inline_t > =A0 =A0 | Bold: 'a inline_t list -> 'a inline_t > =A0 =A0 | Link: string -> [< inkind > `Link ] inline_t > =A0 =A0 | Mref: string * [ `Nonlink ] inline_t list -> [< inkind > `Link = ]=20 > inline_t Thanks for the input!=A0 You are right, it is easy to forget that a declara= tion such as [> `Nonlink ] is way more open than intended, particularly in this case where only `Nonlink and `Link are in play. Anyway, this sort of "closed variant", though mentioned in the language ref= erence, is a subtlety of polymorphic variants which is not mentioned in section 4.2= (tutorial) of the manual.=A0 I know the manual is not intended as a full-blown tutoria= l on the language, but I reckon it could benefit from mentioning this aspect... Best regards, Dario Teixeira