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 5A3C57EE25 for ; Thu, 31 Oct 2013 22:27:48 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of wojciech.meyer@gmail.com) identity=pra; client-ip=74.125.82.50; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="wojciech.meyer@gmail.com"; x-sender="wojciech.meyer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of wojciech.meyer@gmail.com designates 74.125.82.50 as permitted sender) identity=mailfrom; client-ip=74.125.82.50; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="wojciech.meyer@gmail.com"; x-sender="wojciech.meyer@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-wg0-f50.google.com) identity=helo; client-ip=74.125.82.50; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="wojciech.meyer@gmail.com"; x-sender="postmaster@mail-wg0-f50.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtACAMbKclJKfVIylGdsb2JhbABZDsN2gSkWDgEBAQEHCwsJEiqCJgEFQAEbHQEDDAYFCxYlDwEEDxEBBQEiE4d0AQMPBAGeH4xXgwqEPQoZJw1kiQEBBQyPQweELgOYCpAdQYQSPw X-IPAS-Result: AtACAMbKclJKfVIylGdsb2JhbABZDsN2gSkWDgEBAQEHCwsJEiqCJgEFQAEbHQEDDAYFCxYlDwEEDxEBBQEiE4d0AQMPBAGeH4xXgwqEPQoZJw1kiQEBBQyPQweELgOYCpAdQYQSPw X-IronPort-AV: E=Sophos;i="4.93,612,1378850400"; d="scan'208";a="32935609" Received: from mail-wg0-f50.google.com ([74.125.82.50]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 31 Oct 2013 22:27:47 +0100 Received: by mail-wg0-f50.google.com with SMTP id n12so3351335wgh.29 for ; Thu, 31 Oct 2013 14:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=V/6bHKt8rNY8b9loQLKxJlv2hHuVHiU7PQm8MqioWw0=; b=igzWCkukuK0H/PBZBuRIa99NsH1sNGzLzzZl1OpjkTsVLCuZh40Z5up0MsSBsucOTH 6RSjf4y+LHfrhz5uGy/yC4k+/xXVKkI+riQfRoxHEy23yW+70RM1Sw77MLj66cf8zoE1 pKMw4xs495Nk5HM07anxY/KtyNei0b/af1YSNMhDByh1yEAVLSqgqfBCXSwn4kARP0f4 qoS4UYR1Je/1J02RkWNsjkPzicsQ5Z4BUjYHdd6Cadeshtw2l0rZzLpy3rHCY4WIY82I QbQx2CAKC6Mbfu1Aedbt60CMAvoHjHMp6iY8n0lCre6h6N4zeww1pPur4Quyp1e/dYNl annw== X-Received: by 10.180.99.99 with SMTP id ep3mr41719wib.11.1383254867428; Thu, 31 Oct 2013 14:27:47 -0700 (PDT) Received: from danmey-desktop.danmey.org (cpc2-cmbg12-0-0-cust796.5-4.cable.virginm.net. [86.9.203.29]) by mx.google.com with ESMTPSA id dq11sm103430wid.3.2013.10.31.14.27.46 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 31 Oct 2013 14:27:46 -0700 (PDT) From: Wojciech Meyer To: Nicolas Ojeda Bar Cc: caml-list@yquem.inria.fr References: Date: Thu, 31 Oct 2013 21:27:52 +0000 In-Reply-To: (Nicolas Ojeda Bar's message of "Thu, 31 Oct 2013 20:13:24 +0000") Message-ID: <87r4b16sh3.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Caml-list] recursive types and modules problem Nicolas Ojeda Bar writes: > What is the best way to rewrite the following recursive definitions so that > I can actually compile them? > > S = Set.Make (struct type t = t1 let compare x1 x2 = x1.stamp - x2.stamp end) > > type t1 = { > stamp : int; > x : t2 > } > > and t2 = { > y : S.t > } You just need to wrap it to recursive modules: >>>> module rec Foo : sig module Baz : sig type t1 end module S : sig type t end end = struct module Baz = struct type t1 = { stamp : int; x : Bar.t2 } type t = t1 let compare x1 x2 = x1.stamp - x2.stamp end module S = Set.Make(Baz) end and Bar : sig type t2 end = struct type t2 = { y : Foo.S.t } end <<<< -- Wojciech