caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: William Lovas <wlovas@stwing.upenn.edu>
To: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] cyclic types
Date: Sun, 30 Jan 2005 02:19:23 -0500	[thread overview]
Message-ID: <20050130071922.GA2798@force.stwing.upenn.edu> (raw)
In-Reply-To: <7f8e92aa050129220540e72c6d@mail.gmail.com>

On Sun, Jan 30, 2005 at 08:05:23AM +0200, Radu Grigore wrote:
> Only one (small) problem remains. I do not understand this:
> 
> # type t = t StringMap.t option;;
> The type abbreviation t is cyclic
> # type t = Some of t StringMap.t | None;;
> type t = Some of t StringMap.t | None

The first is a type abbreviation, while the second is a datatype
declaration.  They both introduce a new type, in some sense: the first does
so by asserting its equality to some existing type, while the second does
so by defining one or more coercions from existing types to the new type
(i.e. constructors).  Only the second can refer to the type being defined
on the right-hand side, for the reasons mentioned earlier.

cheers,
William


  reply	other threads:[~2005-01-30  7:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-29 12:15 Radu Grigore
2005-01-29 12:34 ` Radu Grigore
2005-01-29 13:42 ` [Caml-list] " Remi Vanicat
2005-01-29 17:12   ` brogoff
2005-01-29 17:33     ` Radu Grigore
2005-01-29 23:47       ` Damien Doligez
2005-01-30  5:56         ` brogoff
2005-01-30  6:05         ` Radu Grigore
2005-01-30  7:19           ` William Lovas [this message]
2005-01-30 10:33       ` Xavier Leroy
2005-01-30 11:44         ` sejourne_kevin
2005-02-01  9:27         ` Christophe Raffalli
2005-01-29 21:02     ` skaller
2005-01-30  6:46       ` brogoff

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=20050130071922.GA2798@force.stwing.upenn.edu \
    --to=wlovas@stwing.upenn.edu \
    --cc=caml-list@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).