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 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 907DEBC37 for ; Mon, 13 Jul 2009 14:45:50 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoICAN7JWkrRVd67kGdsb2JhbACYaj8BAQEBCQkMBxMDoiGBGo4tAQMCBIQFBQ X-IronPort-AV: E=Sophos;i="4.42,389,1243807200"; d="scan'208";a="31106424" Received: from mail-pz0-f187.google.com ([209.85.222.187]) by mail3-smtp-sop.national.inria.fr with ESMTP; 13 Jul 2009 14:45:48 +0200 Received: by pzk17 with SMTP id 17so1403581pzk.1 for ; Mon, 13 Jul 2009 05:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=ncLK+otLeQcQXWHJow45QEjRO8wumKHTMwWo6AlQom0=; b=l4cBXq9AYaAcUY8tB9fBBHkUkam53wCZTKSAeYbDs0c2wP/1sfHddsomgke6HUg6lt QwWgRdQvvKvkwA8P0rpb4VEWMRk1DFahWdpjcsMp/48WwLKGbxnZrRgGkYCnmr8WolDl DrxZxeBUhFB+5WuLsM8t5Wa/DQ4Fcvo5O6gik= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=ZcdZxcUr14FOF/LtPf6NWTJ7/Ouk/5Zk93fBBHb3HJJ/SPzIPotW9ATkZ/w/in0gXY U+uS0uOmvRpTa0yGbB/Q9agvq6icM3KXCCNOawsN16FgqLO+aCFvHe1O2IdgqHF0fQpA CzQx2m4gu/sUYGif/MqnF2XM/0hYLc0223Aag= Received: by 10.142.239.11 with SMTP id m11mr1373186wfh.93.1247489147457; Mon, 13 Jul 2009 05:45:47 -0700 (PDT) Received: from ?192.168.0.11? (adsl-69-154-34-9.dsl.stlsmo.swbell.net [69.154.34.9]) by mx.google.com with ESMTPS id f42sm17856102rvb.7.2009.07.13.05.45.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 13 Jul 2009 05:45:46 -0700 (PDT) Message-ID: <4A5B2C76.9060603@gmail.com> Date: Mon, 13 Jul 2009 07:45:42 -0500 From: Edgar Friendly User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: Dario Teixeira Cc: caml-list@inria.fr, oleg@okmij.org Subject: Re: [Caml-list] GADTs in OCaml References: <468067.61779.qm@web111510.mail.gq1.yahoo.com> In-Reply-To: <468067.61779.qm@web111510.mail.gq1.yahoo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ocaml:01 ocaml:01 invariants:01 printf:01 scanf:01 node:01 node:01 variants:01 edgar:98 polymorphic:01 wrote:01 caml-list:01 href:97 data:02 structures:02 Dario Teixeira wrote: > Hi, > >> We present a simple, pure, magic-free implementation of a form of >> GADTs in OCaml that is sufficient for the common applications of GADTs >> such as data structures with embedded invariants, typed printf/scanf, >> tagless interpreters. (...) > > Very interesting -- clever, yet so simple! But note that as far as the > link-nodes-shall-not-be-ancestors-of-their-kind problem is concerned, there > is one problem with the presented implementation. Consider the following > declarations: > > let t1 = text "ola" > let t2 = href "http" > let t3 = bold [t1; t2] > let t4 = mref "http" [t1] > > This causes an error upon t4. The reason is that because of t3, t1 was > unified as "node_link node_t", whereas t4 requires it to be "node_nolink node_t". I think the solution is to revert to using polymorphic variants > for the phantom type, and take advantage of their open-ended nature. > (Though I'm guessing some extra massaging will be required -- it's Sunday > and I don't have much time to look into this). > > Anyway, perhaps the Batteries folks will consider including both versions > of the Eq module? It will certainly prove useful for many people. (Am I > correct in assuming you are releasing the code into the public domain or > at least some open-source friendly license?) > > Best regards, > Dario Teixeira > > Absolutely - this kind of thing seems perfect for batteries included. I still need to wrap my head around exactly how to use it, but I'm very happy to have more flexible types available. E