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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id CDD497FA31 for ; Wed, 16 Jul 2014 00:41:10 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of lpw25@cam.ac.uk) identity=pra; client-ip=131.111.8.150; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="lpw25@cam.ac.uk"; x-sender="lpw25@cam.ac.uk"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of lpw25@cam.ac.uk) identity=mailfrom; client-ip=131.111.8.150; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="lpw25@cam.ac.uk"; x-sender="lpw25@cam.ac.uk"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@ppsw-50.csi.cam.ac.uk) identity=helo; client-ip=131.111.8.150; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="lpw25@cam.ac.uk"; x-sender="postmaster@ppsw-50.csi.cam.ac.uk"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoABAMytxVODbwiWnGdsb2JhbAA/GoNgV6xIBpUrh0IBgQ0WDwEBAQEBBg0JCRQohAQBBAEnEz8FCwshJQ8BBEkTiDoIBAk2wziGSxcYhWOJUAeEQwWcY4VIkFdrAQ X-IPAS-Result: AoABAMytxVODbwiWnGdsb2JhbAA/GoNgV6xIBpUrh0IBgQ0WDwEBAQEBBg0JCRQohAQBBAEnEz8FCwshJQ8BBEkTiDoIBAk2wziGSxcYhWOJUAeEQwWcY4VIkFdrAQ X-IronPort-AV: E=Sophos;i="5.01,668,1400018400"; d="scan'208";a="85315179" Received: from ppsw-50.csi.cam.ac.uk ([131.111.8.150]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 Jul 2014 00:41:09 +0200 X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from [109.144.247.124] (port=53978 helo=netbook) by ppsw-50.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (PLAIN:lpw25) (TLSv1.2:DHE-RSA-AES128-SHA:128) id 1X7BPI-0003nI-sf (Exim 4.82_3-c0e5623) (return-path ); Tue, 15 Jul 2014 23:41:09 +0100 From: Leo White To: Alain Frisch Cc: caml-list References: <53C5481B.3070409@frisch.fr> X-Face: "XWxb[u_Z\PA_Y?9@|IA!!+jTb(/290-*ea/Un$I0B98.$n%eL.;2w*,z]WR#T:,p[ NBd++M7l]#7zj7!{~iw $W-"/=|dVjhT[D{4~gE}gK<2`.6fs!;uqqud]vs2N/3^m7{aS1V, Date: Tue, 15 Jul 2014 23:41:08 +0100 In-Reply-To: <53C5481B.3070409@frisch.fr> (Alain Frisch's message of "Tue, 15 Jul 2014 17:26:19 +0200") Message-ID: <86k37e1bzv.fsf@cam.ac.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Caml-list] Existential row types Hi Alain, There is a work-around, but it is quite convoluted: https://sympa.inria.fr/sympa/arc/caml-list/2012-10/msg00131.html There is also a feature request for the feature you propose: http://caml.inria.fr/mantis/view.php?id=6137 Regards, Leo Alain Frisch writes: > Dear all, > > GADTs allow to restrict existential type variables to being an instance of a row type, as in: > > class type c = ... > > type s = > | EX: ((#c as 'a) -> unit) * (unit -> 'a) -> ex > > > I'm wondering if it is possible to simulate such restricted existential quantification with first-class module and > private row types. Something like: > > > module type S = sig > type t = private #c > val f: t -> unit > val g: unit -> t > end > > let foo (type t_) (f : (#c as t_) -> unit) (g : unit -> t_) = > let module M = struct > type t = t_ > let f = f > let g = g > end > in > (module M : S) > > > This does not work, of course, because of the "... as t_". Is there a local work-around? If not, I'm wondering if if > would be easy (and make sense) to introduce a form for introducing locally private row types: > > let foo (type t_ = private #c) (f : t_ -> unit) (g : unit -> t_) = ... > > > > -- Alain