caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: Dennis Walter <dennis.walter@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Nested modules with equal types
Date: Thu, 29 Apr 2010 19:45:47 +0200	[thread overview]
Message-ID: <87d3xikv90.fsf@frosties.localdomain> (raw)
In-Reply-To: <u2h7a5c95d31004291020m4d0b0d50p8663be62f04feb5c@mail.gmail.com> (Dennis Walter's message of "Thu, 29 Apr 2010 19:20:48 +0200")

Dennis Walter <dennis.walter@gmail.com> writes:

> Hi,
>
> is there a way in OCaml to define nested modules where a type t of the
> inner module is defined as equal to the out type of the same name?
>
> For example, I would like to define a file outer.ml containing
>
> type t
> module Inner :
> sig
>   type t = t
> end
>
> but I get the error
> Error: The type abbreviation t is cyclic
> which kind of makes sense. Can I somehow refer to Outer.t in the Inner
> module? (Outer.t does in fact not work either).
>
> Thanks!

type t
module Inner =
struct
  type tmp = t
  type t = tmp
end

MfG
        Goswin


      reply	other threads:[~2010-04-29 17:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-29 17:20 Dennis Walter
2010-04-29 17:45 ` Goswin von Brederlow [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=87d3xikv90.fsf@frosties.localdomain \
    --to=goswin-v-b@web.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=dennis.walter@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).