Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Jean-Christophe Filliâtre" <Jean-Christophe.Filliatre@lri.fr>
To: Keiko Nakata <keiko@kurims.kyoto-u.ac.jp>
Cc: tews@cs.ru.nl, caml-list@inria.fr
Subject: Re: [Caml-list] recursive modules: Cannot safely evaluate the	definition
Date: Fri, 04 Apr 2008 14:44:21 +0200	[thread overview]
Message-ID: <47F622A5.9060707@lri.fr> (raw)
In-Reply-To: <20080404.180015.125124978.keiko@kurims.kyoto-u.ac.jp>

Keiko Nakata wrote:
> Hello.
> 
> I think that functors cannot be recursive in the current OCaml.

They can:

-----------------------------------------------------------------
module type S = sig type t = int end

module rec F : functor(X : S) -> S = functor(X: S) -> struct
  type t = M.t
end
and M : S = F(struct type t = int end)

let x : M.t = 42
-----------------------------------------------------------------

But it is likely that you won't do anything useful with a functor like
this (try adding a "val x : t" in the signature and to define x in F as
equal to M.x and you'll bump on the "Cannot safely evaluate the
definition of ..." error).

-- 
Jean-Christophe


  reply	other threads:[~2008-04-04 12:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-04  8:44 Hendrik Tews
2008-04-04  9:00 ` [Caml-list] " Keiko Nakata
2008-04-04 12:44   ` Jean-Christophe Filliâtre [this message]
2008-04-04 15:23     ` Hendrik Tews
2008-04-04 15:45       ` Keiko Nakata
2008-04-04 16:17         ` Sebastien Ferre

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=47F622A5.9060707@lri.fr \
    --to=jean-christophe.filliatre@lri.fr \
    --cc=caml-list@inria.fr \
    --cc=keiko@kurims.kyoto-u.ac.jp \
    --cc=tews@cs.ru.nl \
    /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