From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id CEE37BB84 for ; Thu, 1 Jun 2006 02:13:27 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k510DRjF016886 for ; Thu, 1 Jun 2006 02:13:27 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA26739 for ; Thu, 1 Jun 2006 02:13:26 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k510DOV9016880 for ; Thu, 1 Jun 2006 02:13:25 +0200 Received: from localhost (suiren [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.13.6/8.13.6) with ESMTP id k4VNpH22012995; Thu, 1 Jun 2006 08:51:17 +0900 (JST) Date: Thu, 01 Jun 2006 08:51:13 +0900 (JST) Message-Id: <20060601.085113.112630104.garrigue@math.nagoya-u.ac.jp> To: lgreg.meredith@gmail.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] recursive modules? From: Jacques Garrigue In-Reply-To: <5de3f5ca0605311235h1f1db228t8e10f4ef65233e05@mail.gmail.com> References: <5de3f5ca0605311235h1f1db228t8e10f4ef65233e05@mail.gmail.com> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 447E3127.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 447E3124.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; recursive:01 ocaml:01 compiler:01 abstractly:01 recursive:01 ocaml:01 compiler:01 rtfm:01 rec:01 struct:01 caml-list:01 abstract:01 jacques:01 modules:01 modules:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 From: "L.G. Meredith" > i'm mostly a neophyte with OCaml. Please find below a simple example of a > code i would like to be able to write, but that the compiler will not eat. i > build a term language over a set of variables that are themselves abstractly > characterized in terms of some identifier type. i would like to write a > recursive module in which the abstract type of identifier is essentially the > type of the joinedcompositionfunctor applied to itself. One can show that > this results in a (mathematically) well-founded definition. Is there a > version of OCaml or an OCaml compiler option that will enable this kind of > recursive definition? RTFM :-) Recursive modules are in the "language extensions" chapter. Here is what I believe should be your module (if I understood correctly your intent.) module rec VariableOfRJoinedComposition : (IDENTIFIER with type idType = JoinedCompositionFunctor(VariableOfRJoinedComposition).composite) = struct module RJoinedCompositionEquivalence = Equivalence ( JoinedCompositionFunctor )( VariableOfRJoinedComposition ) type idType = RJoinedCompositionEquivalence.JoinedComposition.composite let comparator = RJoinedCompositionEquivalence.structural end