From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 967747ED34 for ; Mon, 16 Jul 2012 16:45:33 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of darioteixeira@yahoo.com) identity=pra; client-ip=98.138.91.161; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="darioteixeira@yahoo.com"; x-sender="darioteixeira@yahoo.com"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of darioteixeira@yahoo.com) identity=mailfrom; client-ip=98.138.91.161; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="darioteixeira@yahoo.com"; x-sender="darioteixeira@yahoo.com"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@nm1-vm4.bullet.mail.ne1.yahoo.com) identity=helo; client-ip=98.138.91.161; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="darioteixeira@yahoo.com"; x-sender="postmaster@nm1-vm4.bullet.mail.ne1.yahoo.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag0CAKwnBFBiiluhh2dsb2JhbAA4DaggkTcBAQEKCwkHFieCGwUBAQQBCxwEFQECFSIBAwsGBUYvAQ4BBhIGiBABAQIGBgSqFwmCaIRdASMDASMDiVEBBgoBAZF7A4hLjHeFTy1NiFqDWw X-IronPort-AV: E=Sophos;i="4.77,594,1336341600"; d="scan'208";a="150799662" Received: from nm1-vm4.bullet.mail.ne1.yahoo.com ([98.138.91.161]) by mail4-smtp-sop.national.inria.fr with SMTP; 16 Jul 2012 16:45:32 +0200 Received: from [98.138.90.51] by nm1.bullet.mail.ne1.yahoo.com with NNFMP; 16 Jul 2012 14:45:30 -0000 Received: from [98.138.88.232] by tm4.bullet.mail.ne1.yahoo.com with NNFMP; 16 Jul 2012 14:45:30 -0000 Received: from [127.0.0.1] by omp1032.mail.ne1.yahoo.com with NNFMP; 16 Jul 2012 14:45:30 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 890875.17258.bm@omp1032.mail.ne1.yahoo.com Received: (qmail 35969 invoked by uid 60001); 16 Jul 2012 14:45:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1342449930; bh=RkoAbzdaNHHY2YU98qjYBbNu9U9BP7phbyg7mKwdU7Q=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=U8xiCpeU0+Q+aA3+zKf6anW7Yk2sC4eOlOzui6aNT6u5hSbzApjBLIgsBog52npVxyYstOTGsDqHZTGvX/Vb/jeYbwQdp7DQ6CQJSnNPOwh9ulZnw6rhlsZsLQQKBkYazK2z0McDjJL0X+Hl5XQ15oo1OXH8JLLrzWJADB1M+cs= 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:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=b2htMnReS0h8q7QOLAA7j+8Y5obhpw/ikBI8NtdgfSLGDxvQRkIDc7na64CwBnvdeQ+1bbIL/+Wj/ZjKoxQWXctM1lW/2tYXBh/nKa225C++fu/nMvxvbVZD2V9db2a92GPz+8Ng80ie7KNX4UbJFSComNvEqH/8K5YRHGV6RzE=; X-YMail-OSG: qnakVzgVM1nMwfSgFaSMdbBnizlE0A7Kh4fDvZhs82NsW6A 4ogmTXaMm Received: from [195.23.39.54] by web111508.mail.gq1.yahoo.com via HTTP; Mon, 16 Jul 2012 07:45:29 PDT X-Mailer: YahooMailWebService/0.8.120.356233 References: <1342371289.7422.YahooMailNeo@web111511.mail.gq1.yahoo.com> Message-ID: <1342449929.34621.YahooMailNeo@web111508.mail.gq1.yahoo.com> Date: Mon, 16 Jul 2012 07:45:29 -0700 (PDT) From: Dario Teixeira Reply-To: Dario Teixeira To: "caml-list@inria.fr" In-Reply-To: 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, > What about something like (not really tested): >=20 > type _ guard_t =3D=A0 =A0 | Nonlinked: [> `Nonlink ] guard_t > =A0 | Either: [> `Nonlink | `Link ] guard_t >=20 > let inlineseq_from_astseq seq =3D > let rec process : type a. a guard_t -> ast_t -> a inline_t =3D=A0 fun gua= rd=20 > ast ->=A0 match (guard, ast) with > =A0 | (Nonlinked, Ast_Text txt)=A0 -> Text txt > =A0 | (Either, Ast_Text txt)=A0 =A0 =A0 -> Text txt > =A0 | (x, Ast_Bold xs)=A0 =A0 =A0 =A0 =A0 =A0 -> Bold (List.map (process = x) xs) > =A0 | (Either, Ast_Link lnk)=A0 =A0 =A0 -> Link lnk > =A0 | (Either, Ast_Mref (lnk, xs))=A0 =A0 =A0 =A0 -> Mref (lnk, List.map= (process=20 > Nonlinked) xs)=A0 | _=A0 -> assert false > in List.map (process Either) seq I see what you mean -- using an auxiliary GADT basically. Nice technique to keep in mind -- thanks! Cheers, Dario