caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: lgreg.meredith@gmail.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] recursive modules?
Date: Thu, 01 Jun 2006 08:51:13 +0900 (JST)	[thread overview]
Message-ID: <20060601.085113.112630104.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <5de3f5ca0605311235h1f1db228t8e10f4ef65233e05@mail.gmail.com>

From: "L.G. Meredith" <lgreg.meredith@gmail.com>

> 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


      reply	other threads:[~2006-06-01  0:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-31 19:35 L.G. Meredith
2006-05-31 23:51 ` Jacques Garrigue [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060601.085113.112630104.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=lgreg.meredith@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).