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 289687EE49 for ; Sat, 21 Sep 2013 02:17:48 +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.220.54; 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.220.54 as permitted sender) identity=mailfrom; client-ip=209.85.220.54; 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-pa0-f54.google.com) identity=helo; client-ip=209.85.220.54; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="postmaster@mail-pa0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiwBAEzlPFLRVdw2m2dsb2JhbABahBGCY0a+NoETCBYOAQEBAQEGCwsJFCiCJQEBBSMdARsdAQMMBgULAwoCAiYCAiIBEQEFARwGExuHVwEDD5x3jABRgweECAoZJw1kiQABBQyBHY48B4JpgTUDl3yQDRgphE07 X-IPAS-Result: AiwBAEzlPFLRVdw2m2dsb2JhbABahBGCY0a+NoETCBYOAQEBAQEGCwsJFCiCJQEBBSMdARsdAQMMBgULAwoCAiYCAiIBEQEFARwGExuHVwEDD5x3jABRgweECAoZJw1kiQABBQyBHY48B4JpgTUDl3yQDRgphE07 X-IronPort-AV: E=Sophos;i="4.90,949,1371074400"; d="scan'208";a="27589540" Received: from mail-pa0-f54.google.com ([209.85.220.54]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 21 Sep 2013 02:17:47 +0200 Received: by mail-pa0-f54.google.com with SMTP id kx10so1335861pab.27 for ; Fri, 20 Sep 2013 17:17:44 -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=TdYFemFt637J4ZiW9YATXqMrlUUUG+jcCd5GahlzLz4=; b=vWCZgWt6NLvGIw8mIPcKhuYDJfcISriKDSNlUe6AJhlgPy7efyBwyOL49LaFHdrTTw I6T35fcjFo2H2t03U/10wc5a/tDgFuf0OeywULfOXBEOQnAPZdaxFaP1RcUKs7ktd9OS xGfmpyawqful9YmudGVal1hQd6jPz6LaCV8iuxlJRqKJLy/JeYWdjPvjIy+MQ77JOyOL /7gu50rmB/zG+kb92MrUlLI4ltODfGhRiyPLlHsmcoUNYQ/Z/IqttfsTsPta+6R3C+Wk qq0oFrIWFCq0eHCv+gfEw+XB7TZc1NrdkH2SbuqBNzB91hVCJIqRznV3Hpmu7Gz1QEXx 6/eg== MIME-Version: 1.0 X-Received: by 10.66.146.199 with SMTP id te7mr11768694pab.106.1379722664895; Fri, 20 Sep 2013 17:17:44 -0700 (PDT) Received: by 10.70.80.162 with HTTP; Fri, 20 Sep 2013 17:17:44 -0700 (PDT) In-Reply-To: References: Date: Sat, 21 Sep 2013 01:17:44 +0100 Message-ID: From: Jeremy Yallop To: Peter Frey Cc: Caml List Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Packing/Unpacking modules On 21 September 2013 00:22, Peter Frey wrote: > I am showing my code (which does not work) first; the rest follows: > > let q = let module M = (val s2:Stream with type a = char) in > (module struct > include (val s2: Stream with type a = char) > let stream = (M.tail (M.stream)) > end : Stream with type a = char ) The root problem here is that there are two types in the Stream signature, of which one (a) is exposed and one (t) is opaque. Each unpacking of s2 gives you a new instance of t which is incompatible with the instances that come from other unpackings. The solution is to unpack s2 only once: let q = let module M = (val s2:Stream with type a = char) in (module struct include M let stream = (M.tail (M.stream)) end : Stream with type a = char )