From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 BE6737F02D for ; Tue, 21 Oct 2014 10:13:02 +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.212.170; 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.212.170 as permitted sender) identity=mailfrom; client-ip=209.85.212.170; 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-wi0-f170.google.com) identity=helo; client-ip=209.85.212.170; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="postmaster@mail-wi0-f170.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuEBAI4ORlTRVdSqlGdsb2JhbABchC4LBIMC0FwCgQcHFgERAQEBAQcLCwkSMIQCAQEBAwESEQQZARsdAQMBCwYFCw0CAiYCAiEBAREBBQEcBhMIGogIAQMJCKMfboswgXKDEIhsChknDWeFRwEBAQEBAQQBAQEBARcBBQ6BHoxxgjQHgneBVAWbSYIRgTCOGIJZggwYKYUsPC+CSwEBAQ X-IPAS-Result: AuEBAI4ORlTRVdSqlGdsb2JhbABchC4LBIMC0FwCgQcHFgERAQEBAQcLCwkSMIQCAQEBAwESEQQZARsdAQMBCwYFCw0CAiYCAiEBAREBBQEcBhMIGogIAQMJCKMfboswgXKDEIhsChknDWeFRwEBAQEBAQQBAQEBARcBBQ6BHoxxgjQHgneBVAWbSYIRgTCOGIJZggwYKYUsPC+CSwEBAQ X-IronPort-AV: E=Sophos;i="5.04,760,1406584800"; d="scan'208";a="84044153" Received: from mail-wi0-f170.google.com ([209.85.212.170]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 21 Oct 2014 10:13:02 +0200 Received: by mail-wi0-f170.google.com with SMTP id hi2so10280175wib.5 for ; Tue, 21 Oct 2014 01:12:57 -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=/sNlgtZH0vlR0V6jKTYBcKozINyBTpzMSF1zZG+baak=; b=iy2igb0NlHho6oxddflFgTuDuaa6+v0M+6qi7QnwL/D47B5v9gViZu1hX4eNrBKpdq WdBfYVicBeMkRRCF/tpnCLU3EhjLhtdTB/ZfqFso9rZle92xEjYYsQVotuMsAaEG+9du OF9Ii5a66SOYOwMKEUfhOasPopQbGl3ExCGmwuWbZli/6vbzAROtJm7dSCIJF08DnPbP L/QbVhAITALFOKF281LaQxa/PFo2Ro7Te/IUgBpc/sAHAkcUaOism63vv/Fd5YNKukLY zYQOcV+H4xuhqT1QEG6AnzwQbpdRPJ/FFPLbIzuqVBpbzZudD6j+XhT1DHOurR6ffIf7 c4Qw== MIME-Version: 1.0 X-Received: by 10.181.27.197 with SMTP id ji5mr26668101wid.26.1413879177651; Tue, 21 Oct 2014 01:12:57 -0700 (PDT) Received: by 10.217.115.5 with HTTP; Tue, 21 Oct 2014 01:12:57 -0700 (PDT) In-Reply-To: References: Date: Tue, 21 Oct 2014 09:12:57 +0100 Message-ID: From: Jeremy Yallop To: Thomas Braibant Cc: OCaML Mailing List Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] First class modules sub-typing On 21 October 2014 08:49, Thomas Braibant wrote: > I am slightly puzzled by a type-error related to first class modules. > I am basically defining two types (see full example below) > > ``` > type t = (module A) > type 'a s = (module A with type I.t = 'a) > ``` > > and I expect a value of type `'a s` can be coerced to a value of type > t. However, this is obviously not the case because I get the following > error message, and I wonder why. Conversions between first class module types need explicit coercions. It's sufficient to change your test4 function as follows: > let test4 (type a) : a s -> string = fun t -> test1 t let test4 (type a) : a s -> string = fun t -> test1 (t :> (module A))