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 B5B0C7FA31 for ; Tue, 15 Jul 2014 17:26:14 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=pra; client-ip=193.252.23.211; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=mailfrom; client-ip=193.252.23.211; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@msa.smtpout.orange.fr) identity=helo; client-ip=193.252.23.211; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="postmaster@msa.smtpout.orange.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhgBAGBHxVPB/BfTnGdsb2JhbABZzxQPAQEBAQEICwkJFCiEMRFAPRYYAwIBAgFLDQgBAYhColOnWJQVAQSbGIcTkFg X-IPAS-Result: AhgBAGBHxVPB/BfTnGdsb2JhbABZzxQPAQEBAQEICwkJFCiEMRFAPRYYAwIBAgFLDQgBAYhColOnWJQVAQSbGIcTkFg X-IronPort-AV: E=Sophos;i="5.01,666,1400018400"; d="scan'208";a="85270159" Received: from msa02.smtpout.orange.fr (HELO msa.smtpout.orange.fr) ([193.252.23.211]) by mail2-smtp-roc.national.inria.fr with ESMTP; 15 Jul 2014 17:26:14 +0200 Received: from [192.168.1.133] ([92.151.54.109]) by mwinf5d59 with ME id SfSD1o00D2MNqdG03fSDRn; Tue, 15 Jul 2014 17:26:13 +0200 X-ME-Helo: [192.168.1.133] X-ME-Auth: bGV4aWZpQHdhbmFkb28uZnI= X-ME-Date: Tue, 15 Jul 2014 17:26:13 +0200 X-ME-IP: 92.151.54.109 Message-ID: <53C5481B.3070409@frisch.fr> Date: Tue, 15 Jul 2014 17:26:19 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: caml-list Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Caml-list] Existential row types 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