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 1BA317FD92 for ; Fri, 10 Jun 2016 22:18:41 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.26,451,1459807200"; d="scan'208";a="180893370" Received: from amontsouris-551-1-55-222.w90-24.abo.wanadoo.fr (HELO pl-59055.rocqadm.inria.fr) ([90.24.174.222]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES256-GCM-SHA384; 10 Jun 2016 22:18:40 +0200 Received: from shindere by pl-59055.rocqadm.inria.fr with local (Exim 4.87) (envelope-from ) id 1bBSt6-0000ZV-9e; Fri, 10 Jun 2016 22:18:40 +0200 Date: Fri, 10 Jun 2016 22:18:40 +0200 From: =?utf-8?Q?S=C3=A9bastien?= Hinderer To: Gabriel Scherer Cc: caml users Message-ID: <20160610201840.GA2182@pl-59055.rocqadm.inria.fr> Mail-Followup-To: Gabriel Scherer , caml users References: <20160610200021.GA2068@pl-59055.rocqadm.inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Caml-list] Error: The type abbreviation t is cyclic while defining submodules 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 = 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 = float * float let compare = Pervasives.compare (* Other functions on points *) module OrderedPoints : Set.OrderedType with type t = t = struct type nonrec t = t let compare = compare end module PointSet (* : Set.S with type t = t *) = Set.Make(OrderedPoints) Note the commented bit in the last line, when it is uncommented it does indeed not work. Thanks, Sébastien.