caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Mutually recursive types in different modules
Date: Mon, 14 Jul 2008 18:04:32 +0100	[thread overview]
Message-ID: <200807141804.32640.jon@ffconsultancy.com> (raw)
In-Reply-To: <1216054202.29061.2.camel@andre.mz.digirati.com.br>

On Monday 14 July 2008 17:50:02 Andre Nathan wrote:
> Hello
>
> Say I have the following type definition:
>
>   type a = { x: int; foo: b } and  b = { y: int; bar: a }
>
> Is it possible to define types a and b in their own files (thus in
> modules A and B) and still allow them to be mutually recursive?

Yes. See the OCaml Journal article "Tricks with recursion: knots, modules and 
polymorphism" or Google for the phrase "untying the recursive knot".

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e


  reply	other threads:[~2008-07-14 17:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14 16:50 Andre Nathan
2008-07-14 17:04 ` Jon Harrop [this message]
2008-07-14 17:50   ` [Caml-list] " Andre Nathan
2008-07-14 17:57   ` Arthur Chan
2008-07-14 18:04     ` Andre Nathan
2008-07-14 17:43 ` Martin Jambon

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=200807141804.32640.jon@ffconsultancy.com \
    --to=jon@ffconsultancy.com \
    --cc=caml-list@yquem.inria.fr \
    /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).