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 A031E7FD92 for ; Fri, 10 Jun 2016 22:23:48 +0200 (CEST) IronPort-PHdr: 9a23:OA5kXBe6g6/2llFajnodjCjmlGMj4u6mDksu8pMizoh2WeGdxc+6YR7h7PlgxGXEQZ/co6odzbGG4ua/BidZvczJmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbviqtuMPE4R2GD1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu2pN5g/GJNRBi4nPmR938bruAPOV0Pb6XIWSGQbllxTCAjI9hzgdpj0uyr+8OF63X/edcb/SLR8RC+v9bwjHBThjSNCMz8i7EnWjNZxheRVukTyiQZ4xtv7aYuPNfd6NpjWfd4ASHAJCslYXTZAD4f6dIAPAvAMJ85XqoD8ox0Fqh7oVlrkP//m1jId3iy+5qY9yel0SQw= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-it0-f65.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.65; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.65 as permitted sender) identity=mailfrom; client-ip=209.85.214.65; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@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-it0-f65.google.com) identity=helo; client-ip=209.85.214.65; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-it0-f65.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0C+AQB+IVtXa0HWVdFegz4egTUGr3uLJYF6hhcCgSQHOBQBAQEBAQEBARELCwwIHzGCMIIWAQEEEhEdARseAwwGBQsNAgImAgIiAREBBQEcBgESIodzAQMXn1WBMT4xizuBaoJZBYc1ChknDVKDLAEBCAIBHAIGEHGFJoRNhECDAYJaAQSYX4FYjFCPII4sEh6BDx6CMD+BUSAyiggBAQE X-IPAS-Result: A0C+AQB+IVtXa0HWVdFegz4egTUGr3uLJYF6hhcCgSQHOBQBAQEBAQEBARELCwwIHzGCMIIWAQEEEhEdARseAwwGBQsNAgImAgIiAREBBQEcBgESIodzAQMXn1WBMT4xizuBaoJZBYc1ChknDVKDLAEBCAIBHAIGEHGFJoRNhECDAYJaAQSYX4FYjFCPII4sEh6BDx6CMD+BUSAyiggBAQE X-IronPort-AV: E=Sophos;i="5.26,451,1459807200"; d="scan'208";a="180893586" Received: from mail-it0-f65.google.com ([209.85.214.65]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 10 Jun 2016 22:23:47 +0200 Received: by mail-it0-f65.google.com with SMTP id i6so668430ith.0 for ; Fri, 10 Jun 2016 13:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=dmA2DKxTa8zS39QnCjZNWEpI3w2gaPAUdzxoFDHW3G0=; b=rDD5rj9GXgRXbXb2buth1E/nb2IiDvnX2aYUX7BKd26xFxL1hVfmaEM/NJh3yxTSRj WUovJNY4m67RBvCQdGBHvCW/ymCTbBk1HEOLgRSH29f12TRWX2sPGDqNfvUt9XcqyFY0 R5VQGIDTJ8EbPXKdN8562NoCRAwMG0hHYdPXnGnIctjja5i3XT+Z8iPNaC3vVNDf3hSj TBmJWlUUHN/4QAU4Uos3wvVemUQfBmjI/9pP4iEehwWwynNx0FKIucA2+OGPEqhWtwEV OqaPGOIMImctnHM29AkqSozzEBbYhNtdVz2ypofa5OSk+ssVbeKKqzn/ZFFJ4cxO7r+1 q48w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=dmA2DKxTa8zS39QnCjZNWEpI3w2gaPAUdzxoFDHW3G0=; b=WvMslGxryyHFmpoW0Z+ge/AcgF1fOUJlAT7ntWucSm4aecVFH8xKtq6B1qGurlDtH5 ZOmomInwhBLewmCvrwKwdyFTd/aoTyfh5DFnlIWhEGQQyKS5IL50iLtvPV/xS2xsmLVv 14e3FWs5w4dtOIH2EGvgeG39QisYR/xEKWmBwNeoPOCeZeG1AWwIzC/sn992eFyeJbI9 XVmS2svuYCHeNoht+dQHu2X+jzA9OCXVaMaDlONAD+7a9A1RvE8odIHjb4+mLjPvj8mU Qnmglv+3IlxiONYY2EPiYtiNNP4b+Hkc8UAhbbAE/Mg7xJ512UnekyEb9KVHl88c4n8m 0mgA== X-Gm-Message-State: ALyK8tLvPp4Uo3OUXowSYRTkz0V23EcMBpiolWXx+v7UQv192ttFu6rAsUqa58CM2KcbpIX+XOdGhH/UlO6AJw== X-Received: by 10.36.64.8 with SMTP id n8mr1476875ita.21.1465590226415; Fri, 10 Jun 2016 13:23:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.89.195 with HTTP; Fri, 10 Jun 2016 13:23:07 -0700 (PDT) In-Reply-To: <20160610201840.GA2182@pl-59055.rocqadm.inria.fr> References: <20160610200021.GA2068@pl-59055.rocqadm.inria.fr> <20160610201840.GA2182@pl-59055.rocqadm.inria.fr> From: Gabriel Scherer Date: Fri, 10 Jun 2016 16:23:07 -0400 Message-ID: To: Gabriel Scherer , caml users Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Error: The type abbreviation t is cyclic while defining submodules I think the problem is rather that the Set.S signature has abstract types "t" (for sets) and "elt" (for elements), and that you mean "with type elt =3D t" here. Note that you don't need any of the signature constraints here: module OrderedPoints =3D struct type nonrec t =3D t let compare =3D compare end module PointSet =3D Set.Make(OrderedPoints) works. On the other hand, (module OrderedPoints : Set.OrderedType =3D ...) is not good as it makes OrderedPoints.t an abstract type, and thus you cannot use it from client code afterwards. Finally, if you want your code to type-check under an older OCaml version without nonrec, you can work around the lack of it with synonyms type u =3D t module OrderedPoints =3D struct type t =3D u let compare =3D compare end On Fri, Jun 10, 2016 at 4:18 PM, S=C3=A9bastien Hinderer wrote: > Gabriel Scherer (2016/06/10 16:05 -0400): >> P.S.: Note that "nonrec" is only in definitions (struct .. end) and >> signatures (sig .. end), not in equations such as "with type t =3D t" >> which are a different construct, interpreted recursively -- not the >> best choice for consistency, but well. > > So to make an equality between two types public one has to first > introduce a signature, right? > > Now the code looks like this: > > type t =3D float * float > > let compare =3D Pervasives.compare > > (* Other functions on points *) > > module OrderedPoints : Set.OrderedType with type t =3D t =3D struct > type nonrec t =3D t > let compare =3D compare > end > > module PointSet (* : Set.S with type t =3D t *) =3D Set.Make(OrderedPoint= s) > > Note the commented bit in the last line, when it is uncommented it does > indeed not work. > > Thanks, > > S=C3=A9bastien.