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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 029247FCE0 for ; Wed, 1 Apr 2015 14:27:38 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of yallop@gmail.com) identity=pra; client-ip=209.85.192.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="yallop@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of yallop@gmail.com designates 209.85.192.46 as permitted sender) identity=mailfrom; client-ip=209.85.192.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="yallop@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qg0-f46.google.com) identity=helo; client-ip=209.85.192.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="postmaster@mail-qg0-f46.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DaAADc4htVlC7AVdFcg1hcBYMQwkWFcwKBOQdMAQEBAQEBEQEBAQEHCwsJEjCEFQEBBBIRHQEbHQEDDAYFCw0CAiYCAiIBEQEFARwGEwgah3gBAxENqEY+MYsxgWuCd44hChknDVSEfAEBAQEGAQEBARgBBQ6BE4oIhBYRAVAHgmiBRQWaWZJ0EiOBDAmCJByBUT0xAQGBCYE4AQEB X-IPAS-Result: A0DaAADc4htVlC7AVdFcg1hcBYMQwkWFcwKBOQdMAQEBAQEBEQEBAQEHCwsJEjCEFQEBBBIRHQEbHQEDDAYFCw0CAiYCAiIBEQEFARwGEwgah3gBAxENqEY+MYsxgWuCd44hChknDVSEfAEBAQEGAQEBARgBBQ6BE4oIhBYRAVAHgmiBRQWaWZJ0EiOBDAmCJByBUT0xAQGBCYE4AQEB X-IronPort-AV: E=Sophos;i="5.11,503,1422918000"; d="scan'208";a="107916547" Received: from mail-qg0-f46.google.com ([209.85.192.46]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 01 Apr 2015 14:27:38 +0200 Received: by qgh3 with SMTP id 3so40345227qgh.2 for ; Wed, 01 Apr 2015 05:27:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ADQ2dL1U4Nq93y07CwK256J20TOLtGNgOzM0w50AYUk=; b=wlIlWYeELT4qQ8nWUr1+lnnYW4SXUI9dG1rZU8AAHqUG0xawHqVVhxvrSU/l8nOHpR RXcg+Fefoy0wQiTbLWTBgwqd1Ii1GHmRzllznukZR17yFeDgxbD7dF8C+gN2PMeSlVU1 T+dr5W2Z6D5XPAoWSZcV94jEzlqCUjbo/Z7H7rya805XOy+fVQjq0vDCxkFii+B8E6xW v62SUGBZrzZoLe+RjFJ+NKnXxg6P4jz45s5yJNoZZM4l38RxLjkFGul0Lw9tXW7nuGld dWkZALGetSNrW0Cq6CH49Z/Z/q6iq0wEEgp9mlVaSd2pLzFZFNLo8X3HQqz8gG2raHuN Lcgw== MIME-Version: 1.0 X-Received: by 10.140.151.72 with SMTP id 69mr57044914qhx.68.1427891256914; Wed, 01 Apr 2015 05:27:36 -0700 (PDT) Received: by 10.229.160.11 with HTTP; Wed, 1 Apr 2015 05:27:36 -0700 (PDT) In-Reply-To: <551BE19E.3010302@digirati.com.br> References: <551AE480.1000008@digirati.com.br> <20150331194531.GA12168@yquem.inria.fr> <551B067C.2030006@digirati.com.br> <551BE19E.3010302@digirati.com.br> Date: Wed, 1 Apr 2015 13:27:36 +0100 Message-ID: From: Jeremy Yallop To: Andre Nathan Cc: caml users Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] GADTs and Menhir On 1 April 2015 at 13:16, Andre Nathan wrote: > I'm happy that it works, but the `any` type is a bit of a mistery to me. > In Jeremy's email it's explained as > > "An existential to hide the type index of a well-typed AST, making it > possible to write functions that return constructed ASTs whose type is > not statically known." > > Does anyone have a reference to literature that explains this technique > (I'm guessing that would be Pierce's book)? The OCaml manual briefly > shows an example with a `dyn` type, but not much is said about it. There's a more detailed explanation of the technique in the lecture notes on the following page: http://www.cl.cam.ac.uk/teaching/1415/L28/materials.html The section you want is 8.4.2 Pattern: building GADT values on p83 of the notes from 9 February, but it might also be helpful to look through some of the earlier notes for background. Jeremy.