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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 8E8517EE20 for ; Mon, 19 Nov 2012 15:52:04 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dhouse@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="dhouse@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of dhouse@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="dhouse@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@tot-dmz-mxout1.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="postmaster@tot-dmz-mxout1.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjMBAO9GqlAmacjlmWdsb2JhbABFsCaPFoN9KwEBAQEBCAsLBxQngh4BAQVAAQEsCwEPCwsNDSEiEgEFAQoSBhMSCYdgAwYJAwEHoSiKdIQ3AQWFEgMJiU8GjDSFDZV/gRyNRhYphBGCGQ X-IronPort-AV: E=Sophos;i="4.83,280,1352070000"; d="scan'208";a="163013574" Received: from mx5.janestreet.com (HELO tot-dmz-mxout1.janestreet.com) ([38.105.200.229]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 19 Nov 2012 15:51:30 +0100 Received: from tot-smtp.delacy.com ([172.27.22.35] helo=tot-is-smtp) by tot-dmz-mxout1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1TaSh0-0006tC-0m for caml-list@inria.fr; Mon, 19 Nov 2012 09:51:22 -0500 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-is-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1TaSgz-0007M3-Uc for caml-list@inria.fr; Mon, 19 Nov 2012 09:51:21 -0500 Received: from mail-lb0-f198.google.com ([209.85.217.198]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1TaSgz-0002yT-RB for caml-list@inria.fr; Mon, 19 Nov 2012 09:51:21 -0500 Received: by mail-lb0-f198.google.com with SMTP id n1so2371858lba.9 for ; Mon, 19 Nov 2012 06:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=42EMCmu/4v1g5cGysUS1YuotL2Uz+TQoBJ4n0wYHkN8=; b=lhIpyMTYdxpBQHkmLVAJVa+5flSaLhLGQE0Fv34I+Qr17XXZJoj34DTmPNNKTQZJIX Z/JtaO+9fBbBX90kgpwa2OPNH2eWB4sE47UNQHG1NYhWI7Yt4n/WGyDfFUAOWnR/9Afm fGU8DzAXZ82eP+Y+c22dA6+fPXwOudJ9VngTk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=42EMCmu/4v1g5cGysUS1YuotL2Uz+TQoBJ4n0wYHkN8=; b=TkqlUuYsHD1wEiSHHL8m/k4b8G9KQ5T212qt2hCrZNfAlPAAGwZ7wPTaWjO9pmkJdu iv55qqDuzy61vlYGP05Et6y5XgddtWobexP1HntpgRzCNK8HJK7QcetQkuX4h53QrP9j yF43yPjUS7fP99YFqF/+hreKthUfZlTbyKrVddJo+VflcKI759zKOgHmvHuMPgyko2iF OOS082a+e0OL9ka/iRtiNca3H3wXgpRf9gHJuN1O7J7RuLiFseLLT5VRUu1uGAIliIDd niS2pWNJtHtb6R1o3CiXYiDt3+nCqmxdRh4FIv/16rqd0jpf3W2FgkFguGZMjJY1nqX6 YxYQ== Received: by 10.152.123.103 with SMTP id lz7mr11664931lab.21.1353336681040; Mon, 19 Nov 2012 06:51:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.123.103 with SMTP id lz7mr11664926lab.21.1353336680932; Mon, 19 Nov 2012 06:51:20 -0800 (PST) Received: by 10.112.162.198 with HTTP; Mon, 19 Nov 2012 06:51:20 -0800 (PST) X-Originating-IP: [80.169.196.210] In-Reply-To: <50AA5462.9090201@free.fr> References: <50A9C3BB.2050900@riken.jp> <50A9CB66.1020207@ens-lyon.org> <50A9D378.4020403@riken.jp> <50AA5462.9090201@free.fr> Date: Mon, 19 Nov 2012 14:51:20 +0000 Message-ID: From: David House To: Tiphaine Turpin Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQnQWzJoOnDzqSitBmh/XZXfwz5IFOWN+hU0kjosam8Fb3Q1bop0KhEHMF88KjE9vkj58+N3ap5wYkmOshOGCQVYpDgblr8AlKsQ6QxRGj4CW5Ajxh1oIpsFiRoDHHtoG7nij49QOy7dSj0xFTLzYyJ9OP/Bzg== Subject: Re: [Caml-list] module alias in a .mli file Very clever! I had always been doing the following to re-establish the type equality: module V3 : module type of Vector3 with type t = Vector3.t with type Submodule.t = Vector3.Submodule.t ... etc But again: this is not a true alias. It actually defines and exposes a V3 module as a submodule of your module. E.g. if you're talking about foo.mli then other people would be able to say Foo.V3. On Mon, Nov 19, 2012 at 3:46 PM, Tiphaine Turpin wrote: > In fact, the solution > > > module V3 : module type of Vector3 > > does not work completely, because, the equality between Vector3 and V3 is > lost, which poses problem with the types defined by Vector 3. What works is: > > include module type of struct module V3 = Vector3 end > > Here is a full example: > > module M : sig > > module Vector3 : sig type t end > (* module V3 : module type of Vector3 *) > include module type of struct module V3 = Vector3 end > > end = struct > > module Vector3 = struct type t end > module V3 = Vector3 > > end > > open M > let id (x : Vector3.t) : V3.t = x > > > Regards, > > Tiphaine > > > > On 11/19/12 13:44, Paolo Donadeo wrote: > > Actually this is not true, Martin explained how. :-) > > > -- > Paolo > Sent by Gmail from Android > > Il giorno 19/nov/2012 11:35, "David House" ha > scritto: >> >> Annoyingly though, there is no way to create a module alias in an mli. >> >> If, in an ml file, you have to refer often to >> Some_very_long_module_name, it can quite convenient to define an alias >> by doing "module Mod = Some_very_long_module_name" (or, locally, "let >> module Mod = Some_very_long_module_name in"). But there is no way of >> doing this in an mli: you have to use the long name every time. >> >> This is especially annoying if you have some big type that you want to >> expose in the mli. You really just want to copy-paste out of the ml >> file and stick it into the mli, but then you have to expand all the >> module aliases. (It's just a couple of goes with M-%, but still...) >> >> On Mon, Nov 19, 2012 at 6:36 AM, Francois Berenger >> wrote: >> > On 11/19/2012 03:02 PM, Martin Jambon wrote: >> >> >> >> On Sun 18 Nov 2012 09:29:31 PM PST, Francois Berenger wrote: >> >>> >> >>> Hello, >> >>> >> >>> Here is my stupid question of the day: >> >>> can't I declare the following in a .mli file? >> >>> >> >>> module V3 = Vector3 >> >> >> >> >> >> No, because "= Vector3" specifies an implementation. >> >> An mli file is a module interface, and module interfaces never contain >> >> implementations. >> >> >> >> However, you may want to do this, which does what it says: >> >> >> >> module V3 : module type of Vector3 >> > >> > >> > Thanks a lot! That's exactly what I needed. :) >> > >> > >> > >> > >> > -- >> > Caml-list mailing list. Subscription management and archives: >> > https://sympa.inria.fr/sympa/arc/caml-list >> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> > Bug reports: http://caml.inria.fr/bin/caml-bugs >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs > >