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 848A67F7B4 for ; Fri, 14 Feb 2014 08:23:56 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of Christophe.Troestler@umons.ac.be) identity=pra; client-ip=193.190.208.47; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="Christophe.TROESTLER@umons.ac.be"; x-sender="Christophe.Troestler@umons.ac.be"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of Christophe.TROESTLER@umons.ac.be designates 193.190.208.47 as permitted sender) identity=mailfrom; client-ip=193.190.208.47; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="Christophe.TROESTLER@umons.ac.be"; x-sender="Christophe.TROESTLER@umons.ac.be"; 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@TMGM1.umons.ac.be) identity=helo; client-ip=193.190.208.47; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="Christophe.TROESTLER@umons.ac.be"; x-sender="postmaster@TMGM1.umons.ac.be"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvcBANDD/VLBvtAvnGdsb2JhbABZgmVZV4MCvUcWDgEBAQEBCAsJCRQogk8ECwEgWwImAkkWiBkDmBaPFZoYh3yBKZBGgUkEmCyGMI8hgik X-IPAS-Result: AvcBANDD/VLBvtAvnGdsb2JhbABZgmVZV4MCvUcWDgEBAQEBCAsJCRQogk8ECwEgWwImAkkWiBkDmBaPFZoYh3yBKZBGgUkEmCyGMI8hgik X-IronPort-AV: E=Sophos;i="4.95,843,1384297200"; d="scan'208";a="49038812" Received: from tmgm1.umons.ac.be ([193.190.208.47]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-SHA; 14 Feb 2014 08:23:56 +0100 Received: from EXCHANGEHUB1.umons.ac.be (10.104.2.76) by TMGM1.umons.ac.be (10.104.2.74) with Microsoft SMTP Server (TLS) id 14.3.174.1; Fri, 14 Feb 2014 08:22:28 +0100 Received: from poincare (10.104.2.68) by smtp.umons.ac.be (10.104.2.84) with Microsoft SMTP Server (TLS) id 14.3.174.1; Fri, 14 Feb 2014 08:22:28 +0100 Received: from localhost ([::1]) by poincare with esmtp (Exim 4.82) (envelope-from ) id 1WED7p-00061K-9m; Fri, 14 Feb 2014 08:23:53 +0100 Date: Fri, 14 Feb 2014 08:23:52 +0100 Message-ID: <20140214.082352.48621319473754158.Christophe.Troestler@umons.ac.be> To: OCaml Mailing List From: Christophe Troestler X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: Universite de Mons (http://math.umons.ac.be/anum/) X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.104.2.68] Subject: [Caml-list] First class modules aliases Hi, I have encoutered several annoyances with module aliasing in the context of first class modules. For example, if I declare module type A = sig type t end type 'a a = (module A with type t = 'a) module type IA = A with type t = int type ia = (module IA) then I expect the types “int a” and “ia” to be equivalent but this is not the case: let f (a: int a) = (a : ia) gives the error This expression has type int a = (module A with type t = int) but an expression was expected of type ia = (module IA) That's unfortunate because one may want to use the shortcut “IA” to constraint various module types and still expect to be able to use the general functions for “int a” on those. Another example is: module X = struct module type T = sig type s end type 'a t = (module T with type s = 'a) let id (x: int t) = x end let f (x: int X.t) = x module Y = struct include X let h x = f(id x) end To make it work, I basically have to perform by hand the aliasing that “include X” should make: module Y : sig type 'a t val h : int t -> int t end = struct type 'a t = 'a X.t let h x = f(X.id x) end This problem makes modularity more difficult. Are the above problems that one has to learn to live with when using first class modules or may we expect the type checker to be able to cope with them in the future? Best, C.